Open catenacyber opened 2 years ago
Change https://go.dev/cl/411995 mentions this issue: index/suffixarray: fix index out of range when reading malformed indexes
I think, the code fails because index.Read uses binary.Varint(buf) to calculate the length of the io.Reader's buffer by reading the first 10 bytes as if the first 10 bytes of the buffer contain the length of the buffer. it is a shame that io.Reader has no calls to return the buffer so the len can be called against the io.Reader's buffer. On the other hand i might have misunderstood the code completely.
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?
https://go.dev/play/p/Gk-DGnODS1Y
Another variant https://go.dev/play/p/sr0X0MsAcQ0
ends with panic: runtime error: slice bounds out of range [10:1]
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=47954
cf #52120 but there is no error to be caught here, right ?