paszlib problem: integer overflow

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

paszlib problem: integer overflow

Dennis Poon
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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: paszlib problem: integer overflow

Dennis Poon


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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: paszlib problem: integer overflow

Reinier Olislagers
On 14/11/2013 13:00, Dennis Poon wrote:
> Dennis Poon wrote:
>> I downloaded the Paszlib-sg from
>> http://sagsehome.net/oss/paszlib-sg.php (as suggested by Paszlib
>> freepascal.org wiki).

Which URL exactly?
paszlib-sg doesn't seem to be mentioned in
http://wiki.freepascal.org/paszlib

...
> Is anyone else using this paszlib?
>

I don't know. There's a paszlib unit provided with fpc, so I wonder what
the differences/benefits of paszlib-sg are.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: paszlib problem: integer overflow

Marco van de Voort
In reply to this post by Dennis Poon
In our previous episode, Dennis Poon said:
> Dennis Poon wrote:
> > I downloaded the Paszlib-sg from
> > http://sagsehome.net/oss/paszlib-sg.php (as suggested by Paszlib
> > freepascal.org wiki).

No. It doesn't suggest that. It says that code in FPC originally came from
the same sources as that. But paszlib in FPC has had bugfixes.

> > 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.

That means you enabled that somehow. Integer under/overflow is generally not
enabled by default, and it is somewhat unlogical to use it with converted C
code.

> > 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.

Probably cause by providing external paszlib sources, in combination with
precompiled already there paszlib sources, the compiler gets confused what
depends on what.

Forget about the -sg code for Lazarus, simply use the FPC provided one only.
Turn off the range checks, and try again.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: paszlib problem: integer overflow

Dennis Poon
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.
>>>        
> That means you enabled that somehow. Integer under/overflow is generally not
> enabled by default, and it is somewhat unlogical to use it with converted C
> code.
>
>    
>>> 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.
>>>        
> Probably cause by providing external paszlib sources, in combination with
> precompiled already there paszlib sources, the compiler gets confused what
> depends on what.
>
> Forget about the -sg code for Lazarus, simply use the FPC provided one only.
> Turn off the range checks, and try again.
>
>    

I'd love to just use the paszlib in Lazarus/fpc but I also need the same
unit for Delphi 5 (Dephi 5 program will compress data and send to linux
/lazarus/fpc program ) so both sides need to understand the same
compress/decompress protocol.
I tried using the lazarus/fpc paszlib unit in Dephi 5 but it does not
compile. Too many errors.
The paszlib-sg is the only pascal unit that produces compressed data
readable by FPC's zstream and zipper units.

:-(

Dennis
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: paszlib problem: integer overflow

José Mejuto
El 14/11/2013 18:15, Dennis Poon escribió:

> I'd love to just use the paszlib in Lazarus/fpc but I also need the same
> unit for Delphi 5 (Dephi 5 program will compress data and send to linux
> /lazarus/fpc program ) so both sides need to understand the same
> compress/decompress protocol.
> I tried using the lazarus/fpc paszlib unit in Dephi 5 but it does not
> compile. Too many errors.
> The paszlib-sg is the only pascal unit that produces compressed data
> readable by FPC's zstream and zipper units.
>

Hello,

Both paszlib implementation are very, very similar, so try to spot the
differences. Also are you trying to compress the 70 MB in one shot ?
Post a piece of code that works by itself (just compiles) but that fail
with >70 MB files.


--

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal