You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
triedb/pathdb: add validation for binary.Uvarint in index block operations
This commit adds missing error checking for binary.Uvarint calls in
history_index_block.go to prevent potential infinite loops and crashes
when processing corrupted index block data.
Missing validation could lead to:
- Infinite loops when n == 0 (incomplete varint at end of buffer)
- Negative position values when n < 0 (varint overflow)
- Silent data corruption being ignored
Changes:
- Add n <= 0 validation in readGreaterThan() at lines 179, 203, 223
- Add n <= 0 validation in scanSection() at line 303 with silent break
- Add comprehensive tests for corrupted varint handling
- Follow existing validation pattern from lines 169-172
This follows the same approach as recent fixes in this module:
- Commit d2a5dba: "triedb/pathdb: fix 32-bit integer overflow"
- Commit 11c0fb9: "triedb/pathdb: fix index out of range panic"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
0 commit comments