Skip to content

Handle truncated pack deltas#2147

Merged
jelmer merged 2 commits intojelmer:mainfrom
ctoth:pack-delta-property-discovery
Apr 21, 2026
Merged

Handle truncated pack deltas#2147
jelmer merged 2 commits intojelmer:mainfrom
ctoth:pack-delta-property-discovery

Conversation

@ctoth
Copy link
Copy Markdown
Contributor

@ctoth ctoth commented Apr 21, 2026

Handle truncated pack deltas

Hi! This continues the Hypothesis property-test work for Dulwich.

Summary:

  • add pack delta round-trip properties for create_delta and _create_delta_py
  • add a malformed-delta property that checks parser failures use ApplyDeltaError
  • fix Rust apply_delta bounds checks so truncated copy/insert op streams do not panic
  • run property tests with unittest discovery so new property modules are included

The malformed-delta property found a real panic in the Rust extension. A minimal
reproducer was:

apply_delta(b"", b"\x00\x01\x01")

Before this change, that could panic inside the Rust slice copy path for a
truncated insert operation. After this change, it raises ApplyDeltaError, which
matches the Python-facing error contract used for malformed deltas.

@ctoth ctoth requested a review from jelmer as a code owner April 21, 2026 01:36
@jelmer jelmer enabled auto-merge April 21, 2026 17:28
@jelmer jelmer merged commit 85b4927 into jelmer:main Apr 21, 2026
33 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.

2 participants