Skip to content

test: port compress-zlib-insert buffered-window overflow to nextest - #5893

Merged
oferchen merged 1 commit into
masterfrom
test/uts-nextest-compress-zlib-insert
Jun 17, 2026
Merged

oferchen merged 1 commit into
masterfrom
test/uts-nextest-compress-zlib-insert

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds crates/transfer/tests/uts_18_compress_zlib_insert_buffered_window.rs (UTS-NEXTEST-EDGE.n): integration test pinning the BufferedMap window-length clamp (UTS-18.g.1/.g.2/.g.3) via the public transfer::map_file::BufferedMap API.
  • Mirrors the upstream testsuite/compress-zlib-insert_test.py scenario (issue Handle unbracketed IPv6 daemon operands #951) at unit-test scope. The historical defect surfaced as "exceeds buffer length" on a legitimate full-file map_ptr whenever file_size < MAX_MAP_SIZE (256 KiB) - window_len over-claimed max_window instead of clamping to file_size - window_start. UTS-18.g re-derived the clamp at the single assignment site in crates/transfer/src/map_file/buffered.rs::load_window.

Coverage added

Inline unit tests under crates/transfer/src/map_file/buffered.rs already cover the clamp invariant against fabricated state (load_window_clamps_window_len_to_remaining_file_bytes, negative_bounds::buffered_map_slice_rejects_extending_past_end, etc.). This integration test pins the public API contract the four production map_ptr call sites depend on (token_loop.rs, response.rs, sync.rs, applicator.rs):

  • Full-file map_ptr on a 48128-byte basis (the production crash math) returns Ok with byte-identical contents.
  • Near-EOF first read + cached re-read both return Ok - the clamp holds on initial load AND on cached re-entry.
  • A map_ptr whose offset+len walks past EOF returns Err(UnexpectedEof), never panics on a buffer-index out-of-range.
  • A 4 KiB-chunk sliding-window walk across a 200 KiB basis with a 32 KiB window terminates in an 8 KiB tail window without panic; tail re-read still returns the payload.
  • Exact-fit boundary at file_size == MAX_MAP_SIZE round-trips through the same API.

Lineage

Test plan

  • CI fmt + clippy.
  • CI nextest (stable) - covers the four new tests in uts_18_compress_zlib_insert_buffered_window.rs.
  • CI Windows, macOS, Linux musl stable jobs (tempfile + std I/O only; no platform-specific code).

@github-actions github-actions Bot added the test label Jun 17, 2026
Pins the BufferedMap window-length clamp (UTS-18.g.1/.g.2/.g.3) via
the public map_file API. Mirrors the upstream
testsuite/compress-zlib-insert_test.py scenario (issue #951) at
unit-test scope: a sub-MAX_MAP_SIZE basis must round-trip through
map_ptr without tripping the "exceeds buffer length" guard, and the
clamp must hold on cached re-entry, sliding-window walks, and the
exact-fit boundary.

Inline tests in crates/transfer/src/map_file/buffered.rs already cover
the clamp invariant against fabricated state. This integration test
pins the contract the four production map_ptr call sites depend on
(token_loop.rs, response.rs, sync.rs, applicator.rs).
@oferchen
oferchen force-pushed the test/uts-nextest-compress-zlib-insert branch from 8d63241 to 4a7eb3f Compare June 17, 2026 19:22
@oferchen
oferchen merged commit a5dd1f1 into master Jun 17, 2026
4 of 6 checks passed
@oferchen
oferchen deleted the test/uts-nextest-compress-zlib-insert branch June 17, 2026 19:33
oferchen added a commit that referenced this pull request Aug 24, 2026
…5893)

Pins the BufferedMap window-length clamp (UTS-18.g.1/.g.2/.g.3) via
the public map_file API. Mirrors the upstream
testsuite/compress-zlib-insert_test.py scenario (issue #951) at
unit-test scope: a sub-MAX_MAP_SIZE basis must round-trip through
map_ptr without tripping the "exceeds buffer length" guard, and the
clamp must hold on cached re-entry, sliding-window walks, and the
exact-fit boundary.

Inline tests in crates/transfer/src/map_file/buffered.rs already cover
the clamp invariant against fabricated state. This integration test
pins the contract the four production map_ptr call sites depend on
(token_loop.rs, response.rs, sync.rs, applicator.rs).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant