Skip to content

fix: Reader proceeds to next volume when current one runs out of bytes - #173

Closed
jaens wants to merge 3 commits into
twogood:mainfrom
jaens:main
Closed

jaens wants to merge 3 commits into
twogood:mainfrom
jaens:main

Conversation

@jaens

@jaens jaens commented Sep 13, 2023 •

Copy link
Copy Markdown

Currently, extracting IS5 CABs that split files over multiple volumes seems to fail with bytes_to_read can't be zero, because the current volume runs out of bytes, meaning MIN(bytes_left, reader->volume_bytes_left) becomes 0 which always leads to an error in unshield_reader_read.

Detect this condition and jump to opening the next volume. This is possibly related to #124 and #129, although it might not fix the latter.

@jaens
jaens marked this pull request as ready for review September 13, 2023 17:00
@twogood

twogood commented Sep 15, 2023

Copy link
Copy Markdown
Owner

goto is not something you see everyday! :)

Do you have some .cab files that can be used as test cases?

@twogood twogood self-assigned this Sep 15, 2023
@twogood

twogood commented Sep 15, 2023

Copy link
Copy Markdown
Owner

I wonder why the tests fail :(

@jaens

jaens commented Sep 15, 2023

Copy link
Copy Markdown
Author

goto is not something you see everyday! :)

Can be avoided by restructuring all the surrounding code into nested ifs, I suppose...

Do you have some .cab files that can be used as test cases?

uhh... not sure if abandonware can be distributed as a test case?

I wonder why the tests fail :(

I'll check them locally, might need even more extra checks to prevent infinite loops, in case something else runs out I guess.

@twogood

twogood commented Sep 16, 2023

Copy link
Copy Markdown
Owner

@jaens The existing test cases are pretty much based on abandonware... I need to check that they have not started to fail on main branch as well.

@twogood

twogood commented Sep 17, 2023

Copy link
Copy Markdown
Owner

All tests succeeded in #174 so I can't take in this PR in its current state.

@twogood twogood left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Existing tests must still work
  • Add new test case for this issue (just cut & paste an existing test)

(The goto can be refactored later.)

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 31 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5d9ed6f6-94f2-44b1-ac2a-87ff59f22d22
📥 Commits

Reviewing files that changed from the base of the PR and between 313534b and 58f408a.

📒 Files selected for processing: 1
  • lib/file.c
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@twogood

twogood commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

What this change does: Handles the same exact-volume-boundary read condition as #231.

Must fix: Like #231, it can repeatedly open the same next volume when unshield_reader_open_volume() returns success without advancing reader state. I reproduced the existing avigomanager_new_compression test hanging and had to terminate it.

Must fix: This PR additionally removes goto exit after failing to read the two-byte compressed-chunk length. Processing then continues using a partially read or stale/uninitialized length buffer. Restore that error exit.

A small shared fix in the volume-opening routine plus regression coverage is preferable to maintaining two versions of the same patch.

Verdict: The reported bug matters, but do not merge this version. Fix #231 and close this as a duplicate once that fix lands.


Branch update correction: The initial update used a force-pushed rebase. The original PR commits have now been restored as first-parent history with a merge commit, pushed normally without force. Both the original and previously rebased commits remain reachable. The reviewed file contents are unchanged.

Review basis: main 313534b (after #199), with current logging, assertions, I/O callbacks, and GCC 14/15 CI preserved in conflict resolutions. No functional fixes to the findings above were folded into the branch update. Local checks used macOS arm64, shared Debug builds with bundled MD5 unless stated otherwise; native MSVC and glibc runtime checks were not performed.

Restore the original contribution commits as the first-parent history.
Keep the reviewed conflict resolutions and current main without rewriting published history again.
@twogood

twogood commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Closing as a duplicate of #231, which now includes the shared volume-reader fix and synthetic regression coverage in fd51518. The tests cover exact volume boundaries, missing or unrelated next-volume segments, and IS5 files whose first segment is in a later cabinet. Both the Debug/shared/bundled-MD5 and Release/static/OpenSSL test suites pass locally (25/25 each). Thank you for the original report and contribution.

@twogood twogood closed this Oct 18, 2026
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.

2 participants