Skip to content

COMPRESS-735: Reject entries and writes after SevenZOutputFile.finish() - #846

Open
Marti2203 wants to merge 1 commit into
apache:masterfrom
Marti2203:sevenz-entry-after-finish
Open

Marti2203 wants to merge 1 commit into
apache:masterfrom
Marti2203:sevenz-entry-after-finish

Conversation

@Marti2203

Copy link
Copy Markdown

Fixes COMPRESS-735.

SevenZOutputFile accepted putArchiveEntry() and write() after finish(). The late data overwrote the first entry's packed data while the header written by finish() still described the first entry, so the archive was corrupt without any error. A second finish() was already rejected.

This rejects both after finish(): putArchiveEntry() throws IllegalStateException, because its signature declares no IOException and adding one would break callers, and writes throw ArchiveException with the message finish() already uses. I am happy to change the exception types if you prefer others.

SevenZOutputFileTest.testPutArchiveEntryAfterFinish fails without the change and passes with it; SevenZOutputFileTest and SevenZFileTest pass, and so does mvn -B -DskipTests -DskipITs.

This issue was found by an LLM-Enhanced Static Analysis Engine and verified manually. The patch and this description were prepared with AI assistance (Claude Code) and reviewed by me; the commit carries an Assisted-By: trailer.

putArchiveEntry() and write() were accepted after finish(); the late
data overwrote the first entry's packed data while the finished header
still described it. Throw IllegalStateException from putArchiveEntry()
(its signature has no IOException) and ArchiveException from writes.

Assisted-By: Claude Code:claude-opus-5-5
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.

1 participant