New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debug/elf: Incorrectly double-decompressing ELF section #59208
Comments
A suggestion of how to fix this: I think all the decompression code should live in the |
I'll send a CL for this issue, thanks.
Meanwhile, a good DWARF section should contains with a list of DIEs starts with dwarf.TagCompileUnit(0x11) |
Change https://go.dev/cl/480895 mentions this issue: |
Any chance this will be backported to a 1.20 patch release? |
@brancz Just to be sure, can you confirm that the problem you originally reported is fixed on HEAD? Thanks. |
Sorry for the very late reply, but I can confirm that this has been fixed since the linked change landed. |
For future reference, this was the amd64 debuginfo for Ubuntu xz-utils |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Downloaded the debuginfo for liblzma5:
Tried to look at the DWARF entries:
And running that returns an error:
What did you expect to see?
No error.
What did you see instead?
An error, and I suspect I know why:
debug/elf
in extremely rare cases attempts to double-decompress an ELF section.First the call to
.Data()
returns the decompressed section:go/src/debug/elf/file.go
Line 1308 in 0aa14fc
And if by pure chance the first 4 bytes of the decompressed bytes also happen to be what trigger a decompression, then the
.DWARF()
function will attempt to decompress the section a second time:go/src/debug/elf/file.go
Lines 1317 to 1319 in 0aa14fc
cc @mengzhuo since you recently added this case
The text was updated successfully, but these errors were encountered: