golang / protobuf

Go support for Google's protocol buffers
BSD 3-Clause "New" or "Revised" License
9.64k stars 1.58k forks source link

prototext: error parsing "- " #1530

Closed neild closed 1 year ago

neild commented 1 year ago

The recent prototext change to support parsing numbers with whitespace between the minus sign and number (https://go.dev/cl/473015) has introduced a panic when parsing an incomplete number consisting of a -, whitespace, and no further input.

For example, parsing this panics:

s_int32: - # trailing space after -
neild commented 1 year ago

Fuzzing found this in 260ms on my machine. Probably a good sign we should update internal/fuzz to work with Go 1.18 fuzzing and maybe add a brief run to test.bash.

jhump commented 1 year ago

Oof, that was subtle. Sorry about that. Thanks for addressing so quickly!