[fpc-pascal] paszlib problem: integer overflow

Dennis Poon dennis at avidsoft.com.hk
Thu Nov 14 13:00:51 CET 2013



Dennis Poon wrote:
> I downloaded the Paszlib-sg from 
> http://sagsehome.net/oss/paszlib-sg.php (as suggested by Paszlib 
> freepascal.org wiki).
>
> I works fine on my Delphi 5 until I try to compress a file with size 
> of 70M and it raises the exception of integer flow error.
>
> Does anyone have this problem?
>
> I initially thought it might be a Delphi 5 problem so I tried to use 
> Lazarus with fpc 2.6.2 to compile the same problem but it kept 
> complaining cannot find zstream although I already add FCL package to 
> the required packages list.
>
> Please help.
>
> Dennis
>

I found the bug, it is in  zDeflat.pas
procedure fill_window

line 1595:
   Dec(s.match_start, wsize) ; //which gives integer underflow as 
s.match_start is < wsize and both paramters are defined as unit

When the file to compress is > 30M in size

I am ok to avoid compressing any file that big but I just worried that 
this bug might happen in other situations as well.

Is anyone else using this paszlib?

Dennis




More information about the fpc-pascal mailing list