twogood / unshield

Tool and library to extract CAB files from InstallShield installers
MIT License
350 stars 75 forks source link

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

Open jaens opened 1 year ago

jaens commented 1 year ago

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.

twogood commented 1 year ago

goto is not something you see everyday! :)

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

twogood commented 1 year ago

I wonder why the tests fail :(

jaens commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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