Menu

#176 support for files between 1.6 and 2 GB

closed-fixed
None
5
2008-05-02
2008-04-22
Anonymous
No

currently, because of integer overflow issue, NSIS doesn't support compressing files whose size is between 1.6 and 2 GB

for most cases, it could be solve by adding the following lines in build.cpp in function CEXEBuild::add_db_data

if (bufferlen < 0) // we've hit a signed integer overflow (file is over 1.6 GB)
bufferlen = INT_MAX-st-sizeof(int)-(16 << 20); // so maximize compressor room and hope the file compresses well

under the line

int bufferlen = length + 1024 + length / 4; // give a nice 25% extra space

thanks

Discussion

  • Amir Szekely

    Amir Szekely - 2008-05-02
    • assigned_to: nobody --> kichik
    • status: open --> closed-fixed
     
  • Amir Szekely

    Amir Szekely - 2008-05-02

    Logged In: YES
    user_id=584402
    Originator: NO

    Thanks, fixed with:

    if (bufferlen < 0) // too much data... try allocating as much as possible
    db->resize(max(st, 0x7fffffff));
    else
    db->resize(st + bufferlen + sizeof(int));

     
  • Nobody/Anonymous

    Logged In: NO

    mmh... I think your fix is not correct

    bufferlen is used after the "db->resize" line, and if it does not reflect correctly the space available for compression output, and gets negative,
    the rest of the algorithm won't work...

    the line I indicated in the patch works correctly:
    bufferlen = INT_MAX-st-sizeof(int)-(16 << 20); // so maximize compressor room and hope the file compresses well

     

Log in to post a comment.