[fpc-devel] Buffer error in TDecompressionStream when decompressing some data without deflate header
Архипов Владимир
arkinform at gmail.com
Tue Oct 14 14:19:56 CEST 2014
Hello!
My original task is to make GZIP stream compression/decompression
(preferably without external libraries).
I read zlib specification in http://www.zlib.net/manual.html and tried
to use WindowBits = 16 for automatic GZIP wrapping, but in FPC it does
not works too (in Delphi XE2 works fine).
Also I tried to use simple Deflate mode (DeflateInit and InflateInit
instead of DeflateInit2 and InflateInit2). In this case I can extract
raw zlib data from compressed stream by myself. But when I try to
decompress, I have to emulate simple deflate wrapper, but I have no
adler32 checksum. From GZip I can get only crc32 checksum. When I try
to decompress data with zero adler checksum or without adler checksum
I get error in FPC (but in Delphi XE2 this case works fine too).
Decompression with valid adler32 checksum works fine both in FPC and Delphi XE2.
It is very strange.
2014-10-13 13:08 GMT+04:00 Marco van de Voort <marcov at stack.nl>:
> In our previous episode, ??????? ???????? said:
>>
>> SimpleZipTest('zdeafalatasddfas') - works!
>> SimpleZipTest('lalalalalalalala') - does not work! buffer error!
>>
>> In Delphi XE2 both strings compressed and decompressed without errors.
>
> I quickly checked the bugreport last week and had the following conclusions:
>
> 1. the compressed stream is the same. So the problem is in the
> decompression.
> 2. Probably the first string doesn't compress, so it is stored instead of
> deflated, so that is pretty normal.
> 3. I checked in the paszlib source and skipheader does the same as windows
> bits, but it seems that it was meant to work for both large and small window
> sizes, while -15 is the value for large windowsizes (small buffers are useful on
> embedded, but the origins are in 16-bit dos/win3.x systems).
>
> The code looks roughly sane, but it isn't clear where exactly the error
> shows. I haven't really debugged in detail.
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
--
Regards,
Vladmir Arkhipov
arkinform at gmail.com
More information about the fpc-devel
mailing list