Skip to content
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

fix: Resolve panic in Decoder.Skip() with corrupt message #159

Merged
merged 3 commits into from
Aug 15, 2024

Conversation

dylan-bourque
Copy link
Collaborator

This PR resolves a panic when trying to decode a corrupted message, specifically one where the encoded length of a string field is >2GB.

I also added a new ParseAnnotatedHex() function in a new prototest package. This function can be used to convert a string containing a "commented" hexadecimal representation of an encoded Protobuf message into binary, which is useful for managing test data in a more human-readable form. See the godoc comments on the function for more details.

Finally, I updated .golangci.yml to resolve some config deprecations, which led to having to update some test code that was now generating linter warnings.

Fixes #158

converted run.skip-files to issues.exclude-rules
updated test code under example/ to clear linter warnings
@dylan-bourque dylan-bourque requested a review from a team August 15, 2024 14:09
Copy link

@wmorgan6796 wmorgan6796 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with 1 nit and a question.

decoder.go Outdated Show resolved Hide resolved
decoder.go Outdated Show resolved Hide resolved
@dylan-bourque dylan-bourque force-pushed the fix/panic-in-decoder-skip-with-corrupt-message branch from 2d1363d to 02f92b4 Compare August 15, 2024 14:43
…de()`

added length validation in `DecodeBytes()`, `DecodeNested()`, and `Skip()` on `Decoder`
added tests
@dylan-bourque dylan-bourque force-pushed the fix/panic-in-decoder-skip-with-corrupt-message branch from 02f92b4 to 0112c2a Compare August 15, 2024 15:09
@dylan-bourque dylan-bourque merged commit 9373f47 into main Aug 15, 2024
5 checks passed
@dylan-bourque dylan-bourque deleted the fix/panic-in-decoder-skip-with-corrupt-message branch August 15, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.Decode() indexing panic
2 participants