Repository navigation
chore(sdk): pin the #4202 ZIP64 MaxUint64 stored size in zipstream fuzz test (DSPX-5102) - #4217
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Benchmark results, click to expandBulk Benchmark Results
TDF3 Benchmark Results
|
10244d9 to
026ded2
Compare
…PX-5102) A ZIP64 stored size of 0xFFFFFFFFFFFFFFFF would narrow to int64 -1 and reach make([]byte, -1) (#4202). NewReader already rejects it because every ZIP64 size and offset is checked against the archive bounds (DSPX-4590, #4043), so there is no code change here. The bounds check is written as delta > limit-base. MaxUint64 is the value that wraps if it were ever rewritten as base+delta > limit; the other rows (1<<63, 1<<40) do not wrap, so they would not notice. Add MaxUint64 as a conformance row and as a FuzzReader seed. Both fail if the check is made additive. Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
026ded2 to
53babfa
Compare
Benchmark results, click to expandBulk Benchmark Results
TDF3 Benchmark Results
|
Benchmark results, click to expandBulk Benchmark Results
TDF3 Benchmark Results
|
|
Summary
mainis not affected. DSPX-4590 (fix(sdk): bound zip64 reader offsets against the archive (DSPX-4590) #4043) already checks every ZIP64 size and offset against the archive bounds inNewReader. I confirmed by building the exact archive from the issue.bound.offsetis writtendelta > limit-base.0xFFFFFFFFFFFFFFFFis the value that wraps if someone rewrites it asbase+delta > limit. The existing rows (1<<63,1<<40) don't wrap, so they would not notice that regression.stored size MaxUint64toTestReaderRejectsZip64ValuesBeyondArchiveand the same archive as aFuzzReaderseed.Verification
I mutated the check to
base+delta > b.limitand ran the package. Three tests fail: the new conformance row, the newFuzzReaderseed (the seed runs as a plain test case undergo test, not only under-fuzz), and #4214'sTestManifest_DeclaredSizeBeyondArchiveRejectedWithoutCap. The1<<63and1<<40rows keep passing.Notes
NewTDFReader. The row here is the targeted home for it next to the other bounds rows.ReadAllFileData/readBytes. They are unreachable (ReadFileDataalready bounds its arguments, andNewReaderguarantees non-negative entries), so they were dropped.Testing
go test -raceandgolangci-lintforsdk/internal/zipstream.Summary by CodeRabbit