Skip to content

fix(delta): return errors for malformed streams - #169

Merged
genedna merged 2 commits into
libra-tools:mainfrom
pollychen-lab:agent/delta-decode-errors
Jul 29, 2026
Merged

fix(delta): return errors for malformed streams#169
genedna merged 2 commits into
libra-tools:mainfrom
pollychen-lab:agent/delta-decode-errors

Conversation

@pollychen-lab

Copy link
Copy Markdown
Contributor

Summary

  • convert malformed delta decode inputs from panics into GitDeltaError::DeltaDecoderError returns
  • propagate truncated varint, literal, and copy operand reads instead of unwrapping
  • validate result-size mismatches and copy range overflow without asserting or panicking
  • add regression tests for malformed delta streams

Closes #168

Validation

  • cargo fmt
  • BINDGEN_EXTRA_CLANG_ARGS="-I/usr/lib/gcc/aarch64-linux-gnu/13/include -I/usr/include/aarch64-linux-gnu -I/usr/include" ZSTD_SYS_USE_PKG_CONFIG=1 cargo test delta::decode
  • BINDGEN_EXTRA_CLANG_ARGS="-I/usr/lib/gcc/aarch64-linux-gnu/13/include -I/usr/include/aarch64-linux-gnu -I/usr/include" ZSTD_SYS_USE_PKG_CONFIG=1 cargo test
  • BINDGEN_EXTRA_CLANG_ARGS="-I/usr/lib/gcc/aarch64-linux-gnu/13/include -I/usr/include/aarch64-linux-gnu -I/usr/include" ZSTD_SYS_USE_PKG_CONFIG=1 cargo clippy --all-targets -- -D warnings

pollychen-lab and others added 2 commits July 28, 2026 14:48
- reject overlong size varints with InvalidData instead of shift overflow
- reserve result buffer incrementally and cap output at declared result size
- reuse delta_decode in Pack::rebuild_delta_with_hash and return GitError
- propagate delta rebuild failures from thread pool through SharedParams
- add regression tests for varint overflow, unallocatable sizes,
  output-size overruns, and malformed pack delta objects
@genedna
genedna merged commit 0fd6984 into libra-tools:main Jul 29, 2026
4 checks passed
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.

delta_decode panics on malformed delta streams

2 participants