Repository navigation
test(fuzz): treat shrinking central-directory extra fields as non-streamable - #1306
Conversation
There was a problem hiding this comment.
The changes are correct and well-targeted. The root cause analysis in the PR description is accurate, and the fix is properly scoped to the fuzz harness.
src/write/options.rs: The new extra_fields(&self) -> &[CustomExtraField] accessor is a clean, minimal public API addition needed to let the fuzz harness inspect extra fields without reaching into private internals.
fuzz/write/src/main.rs: central_extra_fields_shrink_on_reopen correctly identifies all three categories of shrinking central-directory extra fields documented in the PR (alignment fields, ZIP64, and ExtendedTimestamp). The ExtendedTimestamp branch logic at line 221 (field.data.len() != 1 && (field.data.len() != 5 || field.data[0] & 1 == 0)) correctly mirrors the re-serialization behaviour of parse_central_header. All test vector cases in shrinking_central_extra_fields_mark_operation_non_streamable are consistent with the logic.
No blocking defects found. The PR is ready to merge.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
Follow-up to #1302 and #1304 per @Pr0methean's direction ("Treat them as non-streamable"), fixing the
fuzz_writeCI failures in run43566959380and unblockingv9.6.0(#1297).Cause
When
ZipWriter::new_appendreopens an archive and rewrites the central directory atdir_start(#1302), any custom extra field whose central-directory representation shrinks on round-trip causesfinalize()(footer_end < stream_end) to zerocentral_startand relocate the footer to EOF:0x5455(ExtendedTimestamp) whendata.len() != 1and(data.len() != 5 || data[0] & 1 == 0)(re-serializes as 1 or 5 bytes).0xa11e(DataStreamAlignment) and0xd935(AndroidZipAlignment), whichExtraFields::central_extra_fieldsomits from the rewritten central directory.0x0001(Zip64ExtendedInfo), whichreplace_zip64_extra_fieldstrips/replaces.Changes
FileOptions::extra_fields(&self) -> &[CustomExtraField](src/write/options.rs).FileOperation::is_streamableasfalsewhencentral_extra_fields_shrink_on_reopen(options)is true (fuzz/write/src/main.rs).reopen-extended-timestamp-extra-field-shrinks.binregression input and unit testshrinking_central_extra_fields_mark_operation_non_streamable./cc @Pr0methean @ychampion
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.