Repository navigation
[TEST] ZipIfstream: cover the corrupt-archive error path (#9460) - #9535
timosachsenberg merged 1 commit into
Conversation
ZipIfstream_test already pinned the empty (FileEmpty), multi-entry (ParseError) and nonexistent (FileNotFound) cases, but not a corrupt archive. Adds a section that writes garbage (non-ZIP) bytes to a *.zip temp file and asserts open() raises Exception::FileNotReadable -- a clear exception rather than a crash or garbage read (libzip's zip_open returns nullptr and, since the file exists, ZipIfstream reports it as not readable). Verified: builds clean and the test runs PASSED. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
@timosachsenberg The following names might be missing from the
Please consider applying the following patch: --- AUTHORS 2026-06-15 16:27:02.527003695 +0000
+++ AUTHORS.new 2026-06-15 16:27:07.756578463 +0000
@@ -23,8 +23,8 @@
- Chirag Dave
- Chris Bauer
- Chris Bielow
- - Christie Mathews
- Christian Ehrlich
+ - Christie Mathews
- Clemens Groepl
- Cornelia Friedle
- Daniel Jameson |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA new ChangesZipIfstream corrupt ZIP error handling test
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
Adds a
ZipIfstream_testsection that writes garbage (non-ZIP) bytes to a*.ziptemp file and assertsopen()raisesException::FileNotReadable— a clear exception rather than a crash or a garbage read.Why
Closes part of the §1 (Qt removal:
minizip-ng → libzip)[AUTO]task in the OpenMS 3.6.0 pre-release testing plan (#9460):ZipIfstream_testalready pins the empty (FileEmpty), multi-entry (ParseError) and nonexistent (FileNotFound) cases, but a corrupt archive was untested. On garbage input, libzip'szip_open()returnsnullptr; since the file exists (not missing),ZipIfstream::openreportsFileNotReadable(ZipIfstream.cpp:56) — this pins exactly that contract and distinguishes it from the missing-fileFileNotFoundpath.Scope note: the ZIP64 portion of that issue line needs a crafted ZIP64-format fixture (a >4 GB / >65535-entry archive), which isn't practical to synthesize SDK-free in a unit test, so it's left for a fixture-backed follow-up; empty is already covered; this PR closes the corrupt gap.
Test plan
Tests only — no production code changed. Verified locally:
-fsyntax-onlyclean, full build green, test runs PASSED (the corrupt case raisesFileNotReadableas expected; the temp file is created and removed by the test).Part of #9460. Follows #9524, #9525, #9526, #9528, #9530, #9531, #9532, #9533, #9534.
🤖 Generated with Claude Code
Summary by CodeRabbit