Closed catenacyber closed 1 year ago
Change https://go.dev/cl/429815 mentions this issue: debug/buildinfo: correct a typo in calculating next align index
CC @golang/compiler
it timeout on the playground because the for
loop below never exits.
The value of i
on line 159 is 1
, and the result of i+buildInfoAlign-1)&^buildInfoAlign
on line 167 is 0
. So on line 167 the data
slice is not changed. Then it enters the next loop with the same data
slice. So the loop never exits.
The purpose of line 167 is data = data[n:]
where n is the smallest number that fulfills n >= i && n % buildInfoAlign == 0
(namely, n
should be 16, 32, 48, ...).
It's obviously there is a typo. The expression should be: data = data[(i+buildInfoAlign-1)&^(buildInfoAlign-1):]
Here are other places that use the same pattern:
Thanks @ZekeLu for the detailed assessment.
I agree that it appears to be a typo and the correct statement is data = data[(i+buildInfoAlign-1)&^(buildInfoAlign-1):]
.
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/IZmSLdUzIaS?v=gotip
What did you expect to see?
The program finishing and printing Hello
What did you see instead?
Found by https://github.com/catenacyber/ngolo-fuzzing on oss-fuzz https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51153