Skip to content

fix(codec): validate scan ranges against file size - #1618

Open
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:fix/codec-validate-scan-range-file-size
Open

fix(codec): validate scan ranges against file size#1618
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:fix/codec-validate-scan-range-file-size

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What changed

Validate that encoded and decoded FileScanTask byte ranges fit within the primary data file. The bounds check uses subtraction so start + length cannot overflow.

Why

The codec rejected negative values but accepted starts beyond EOF, ranges ending beyond EOF, and overflowing range sums. Those values cannot describe a valid segment of the encoded data file.

Testing

  • Added full-file, suffix, and zero-length-at-EOF cases
  • Added beyond-EOF and integer-overflow cases
  • Added direct decode coverage for a malformed envelope
  • go test ./codec

Signed-off-by: Minh Vu <vuhoangminh97@gmail.com>
@fallintoplace
fallintoplace requested a review from zeroshade as a code owner July 30, 2026 19:48
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