twogood/unshield — pull request #2 by stopiccot (2012-12-04 10:57:26+00:00)
Title: Support for more than two volumes + bugfix

Hi, I've encountered a bug in multivolume archive support. For example we have three volumes that contain files [0,20], [20,25], [25,30]. Files 20 and 25 are splitted between volumes. While extracting file 25 it begins with calling unshield_reader_open_volume() for volume 1 and finishes in abort() on line 457. But what we actually need is just skip volume 1 and advance to next one.

Second bug. For some volumes reader->volume_header.first_file_offset can be valid while reader->volume_header.last_file_offset is invalid - 0x7FFFFFFF. I've tried to compare reader->index to reader->volume_header.first_file_index first to solve this issue but this broke everything. So I've added additional sanity check while comparing reader->index to reader->volume_header.last_file_index.

Please note that this changes were made quite fast without deep understanding of codebase so I could broke something unintentionally. It would be great if you have some tests to check my changes.

Here is zip archive with multivolume cab archive I used to reproduce this bugs - https://dl.dropbox.com/u/1777581/data1.cab.zip