-
Notifications
You must be signed in to change notification settings - Fork 18k
debug/buildinfo: over allocation #59817
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
Comments
Like #58886 |
I think that this is the debug/pe version of #54967. After a long discussion in https://go.dev/cl/429601, we decided to return an error for attempts to read the content of a BSS section. We should probably do the same here. CC @ZekeLu @aarzilli @kortschak in case they have any thoughts. |
I can't reproduce this failure either on go1.19 or tip (go1.21-3f987ae61d). |
I can see it with this variant of the program: package main
import (
"bytes"
"debug/buildinfo"
"fmt"
"runtime"
)
func main() {
_, err := buildinfo.Read(bytes.NewReader([]byte{0x4d, 0x5a, 0x64, 0x65, 0x61, 0x64, 0x74, 0x54, 0x59, 0x50, 0x45, 0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x3a, 0x64, 0x65, 0x70, 0x9, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6c, 0x79, 0x4d, 0x69, 0x28, 0xff, 0x20, 0x44, 0x20, 0xb8, 0x63, 0x4f, 0x85, 0x7e, 0xff, 0x1, 0x81, 0x69, 0x6b, 0x0, 0x0, 0x52, 0x6b, 0x6c, 0x4e, 0x6f, 0x53, 0x69, 0x64, 0x9, 0x0, 0x0, 0x0, 0x60, 0x0, 0x0, 0x0, 0x28, 0x6b, 0x6c, 0x4e, 0x6f, 0x3b, 0x53, 0xff, 0x3c, 0x0, 0x5d, 0x6d, 0x6f, 0x64, 0x9, 0x3, 0x79, 0x16, 0x32, 0x23, 0x8, 0x44, 0x7e, 0x61, 0x74, 0x68, 0x9, 0x0, 0x53, 0x0, 0x0, 0x0, 0x0, 0x9, 0x0, 0x5d, 0x40, 0x1, 0x0, 0x0, 0x6c, 0x69, 0x73, 0x74, 0x20, 0x7b, 0xa, 0x7d, 0xa, 0x6c, 0x69, 0x73, 0xff, 0x20, 0x7b, 0x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.TotalAlloc)
} For me this prints |
Yeah, looking past the failure to crash, I see this. The issue is exactly as you describe. Here there is a progressive allocation via saferio of 788546460 bytes. |
The MS docs say that when
This could be made use of in the same way that |
Change https://go.dev/cl/488475 mentions this issue: |
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?
Run https://go.dev/play/p/MrXFx8gd3pK?v=gotip
What did you expect to see?
The program finishing and printing Hello, without allocating too much
What did you see instead?
Nothing : Program exited
Found by https://github.com/catenacyber/ngolo-fuzzing with oss-fuzz :
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58290
The text was updated successfully, but these errors were encountered: