#1 2013-09-18 20:15:05

jpdk
Member
Registered: 2013-09-18
Posts: 1

SynZip: bugfix for zipping a buffer > 200MB

Hi Arnaud,

Thank you for an excellent set of components.

I encountered an issue with TZipWrite.AddDeflated for a buffer larger than 200 MB.
I will post the fix here, as I couldn't find a way to open a ticket.

procedure TZipWrite.AddDeflated(const aZipName: TFileName; Buf: pointer;
  Size, CompressLevel, FileAge: integer);
...
      zlastMod := FileAge;
      tmpsize := (Size*11) div 10+12;
      Getmem(tmp,tmpSize);
...

Size*11 will lead to an integer overflow for buffers larger than 200MB.
A simple way to avoid this is:

      tmpsize := (Int64(Size)*11) div 10+12;

Keep up the good work!

J.

Offline

#2 2013-09-19 05:43:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,283
Website

Re: SynZip: bugfix for zipping a buffer > 200MB

It is now fixed.
See http://synopse.info/fossil/info/e18cbe0a35

Thanks for the feedback!

Offline

Board footer

Powered by FluxBB