Open rodarima opened 9 years ago
Interesting. Are you able to share the installation files with me?
Increasing MAX_FILE_GROUP_COUNT will make unshield read more "file group" entries, and that will push "component" entries forward and that will cause a crash. These are listed by the g and c commands, respectively.
The reason less files are extracted than the file count can be found in the unshield_file_is_valid function. There are a number of cases where a file entry is not actually a file.
I have sent the entire iso (by torrent) to your email.
Using the original MAX_FILE_GROUP_COUNT
set as 71, I can list the groups and components:
$ src/unshield g /mnt/1/data1.cab
...
1648 file groups
$ src/unshield c /mnt/1/data1.cab
...
1445 components
But with the above warning:
WARNING: self->file_group_count = 151
The invalid files (shown by a improvised printf call in unshield_file_is_valid
function), sum exactly the initial ones:
$ src/unshield l /mnt/1/data1.cab | grep 'Invalid file' | wc -l
990
$ echo '19911 + 990' | bc -l
20901
And the cases, classified by increasing number in the branches starting at 1:
$ src/unshield l /mnt/1/data1.cab | grep 'Reason' | sort | uniq -c
384 Reason 3
606 Reason 5
For the reason 3, fd->flags
has the flag FILE_INVALID
, and for the 5, fd->data_offset
is NULL
.
Got it, thanks! I'll see if I can get it working this weekend!
Looks like I didn't get it working that weekend... Due to personal time priorities/constraints I need a PR to fix this, if it's still an issue.
MAX_FILE_GROUP_COUNT seems to only be a limitation of the CabDescriptor, ie: there's a maximum of 70 entry points for the file group offset list. I think that abort() call can be safely removed.
I think me and @rodarima might have been analyzing the same files, something related to Renault. :D
I'm getting trouble extracting a cabinet.
Version from header is 16:
There are 20901 files.
Searching inside the setup.exe:
At lib/component.c on line 53, using gdb,
self->file_group_count
is151
, exceeding theMAX_FILE_GROUP_COUNT
limit set as71
in lib/cabfile.h at line 16.As seen in i6comp at line 34, the max file groups is
512
.Changing the
MAX_FILE_GROUP_COUNT
to 512 produces a segmentation fault:However using the following "patch" on
lib/component.c
, allows to continue on bigfile_group_count
, with the originalMAX_FILE_GROUP_COUNT
set at 71:This patch allows me to extract the cabinet without error, but obviously I have no idea of why.
Using
valgrind
to check buffer overflow (count bigger than MAX), shows no errors:And the number of files is the same as extracted, but not equal to the number of files in the header 20901:
Cabinets are large, in total ~1GB. Any ideas?