-
Notifications
You must be signed in to change notification settings - Fork 175
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
dynamic: panic in decodeVarint #233
Comments
@bradleyjkemp, thanks for posting this! But it doesn't look like GitHub liked the unicode data you added in the Do you mind pasting the value as a literal You might need to post a similar bug against the main project ( Strangely, there is a bounds check right above. But it's not checking for negative values. So perhaps, somehow, this puts the buffer into a bad state where it thinks it's current index in the byte slice is a negative value. |
Never mind about an alternate data value. Looks like even w/ those strange codepoints, I can repro (I guess maybe those are valid codepoints, but GitHub's web font doesn't support them?). Anyhow, looking into it now. |
Yeah I was a bit skeptical of the unicode too but did seem to still work for me when copy-pasted. Here's a different crashing input encoded as base64: |
It looks like this is not an issue in the main protobuf repo. I've added my own methods to this forked code for skipping over chunks of data (length-delimited fields), but wasn't checking for numeric overflow in that code! Fix coming momentarily. |
#235 has a fix that works with both inputs. Instead of panicking, they both return an error:
|
Thanks! Those error messages seem fine for an issue you'll only encounter if something is going very wrong with your data 🙂 |
Hi, this is a bug I found while fuzzing the library so it's probably pretty unlikely anyone will see this in normal usage.
I've been using the unknown field support in dynamic.Message to write a utility to enrich a MessageDescriptor so that it pretends it knows about all the fields present in a message (i.e. so that unknown fields can be marshalled to JSON (and unmarshalled again)).
While fuzzing my implementation I found this index out of range panic in
github.com/jhump/protoreflect/dynamic.(*codedBuffer).decodeVarint
:You can replicate this using this fuzzing harness with
data = "c\x02���O"
:The text was updated successfully, but these errors were encountered: