Skip to content

Validate maxCompressedLength overflow and stream array ranges (#671, #513) - #741

Merged
xerial merged 1 commit into
mainfrom
fix/max-compressed-length
Oct 3, 2026
Merged

xerial merged 1 commit into
mainfrom
fix/max-compressed-length

Conversation

@xerial

@xerial xerial commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Summary

Test plan

  • Added 10 tests to SnappyBoundsCheckTest, including the exact overflow boundary 1,840,700,242 / 1,840,700,243
  • ./sbt test: 133 passed

🤖 Generated with Claude Code

- maxCompressedLength: throw SnappyError(TOO_LARGE_INPUT) instead of
  returning a negative size when the result overflows int, and reject
  negative input sizes (#671)
- Snappy.arrayCopy: check both ranges before the native memcpy, which
  SnappyOutputStream.rawWrite and SnappyInputStream.rawRead rely on
- SnappyOutputStream.write / SnappyInputStream.read: validate offset and
  length against the array, and reject typed-array ranges whose byte
  offset overflows int (#513)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant