Menu

#47 Incorrect group/component handling

closed-out-of-date
Unshield (10)
5
2015-12-17
2005-01-09
Anonymous
No

Encountered in
http://downloads.bioware.com/baldursgate1/bgintl114315.exe
(just unzip it...); unshield attributes every file to
every group, resulting in overwritten files, if each
group contains files of the same name ('dialog.tlk' in
this case).

Discussion

  • David Eriksson

    David Eriksson - 2005-06-15

    Logged In: YES
    user_id=337437

    Very interesting bug!

     
  • David Eriksson

    David Eriksson - 2005-06-15

    Logged In: YES
    user_id=337437

    If I implement support for extract-by-component it might be
    possible to workaround this... hmm...

     
  • Hugh Allen

    Hugh Allen - 2008-03-27

    Logged In: YES
    user_id=1013255
    Originator: NO

    The problem is unshield incorrectly handling CABs with a version of 0x01000004, which snoopy81's Winpack auto-detects as version 5.0.

    unshield extracts the 4th-least-significant nybble from the version and uses that as the major version number, in this case giving 0. There used to be code in libunshield.c which checked for a major version less than 5 and changed it to 5, but it's been #ifed out (line 275). Most of the places which check for version 5 were changed to also check for "version 0" but not the code in file_group.c which reads the first_file and last_file members of each group in the header. Consequently it is filling those values with garbage when reading version 0x01000004 CABs. The obvious fix is to change line 20 from

    if (header->major_version == 5)
    to
    if (header->major_version == 0 || header->major_version == 5)

    This fixes the file groups for bgintl114315.exe, and also a couple of examples I've found:
    http://www.frontechonline.com/driver/pctv.zip (16 MB)
    ftp://ftp.sceptre.com/pub/U2000/VGAWin2K&XP13.zip (46 MB)

    twogood: you might want to review other places in the code which check the major version number.

     
  • David Eriksson

    David Eriksson - 2015-12-17
    • Status: open --> closed-out-of-date
     

Log in to post a comment.

MongoDB Logo MongoDB