core: ssz offset validation#4529
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4529 +/- ##
==========================================
+ Coverage 57.01% 57.10% +0.08%
==========================================
Files 245 245
Lines 32971 33003 +32
==========================================
+ Hits 18799 18845 +46
+ Misses 11789 11783 -6
+ Partials 2383 2375 -8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes a panic when decoding malformed SSZ “versioned” payloads by validating that the decoded offset does not exceed the input buffer length, ensuring unsigned data decoding returns a proper error instead of panicking.
Changes:
- Add upper-bound checks for SSZ offsets in
unmarshalSSZVersionedBlindedandunmarshalSSZVersioned. - Add panic recovery to
UnsignedDataSetFromProtoand factor shared recovery logic intorecoverPanicErr. - Add regression tests covering out-of-bounds SSZ offsets and
recoverPanicErrbehavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
core/ssz.go |
Prevents slice-bounds panics by rejecting SSZ offsets that exceed len(buf). |
core/proto.go |
Ensures panics during unsigned data decoding are converted into errors; centralizes recovery formatting. |
core/proto_internal_test.go |
Adds regression tests to confirm malformed SSZ offsets return ssz.ErrOffset and do not trigger panic recovery. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



Fix SSZ offset validation panic in unsigned data decoding.
category: bug
ticket: none