[Patch] Fix TDecompressionStream.Seek in paszlib
Original Reporter info from Mantis: Hendi48
-
Reporter name: Hendi
Original Reporter info from Mantis: Hendi48
- Reporter name: Hendi
Description:
I found that if you call Read/Seek in an unfortunate order, decompression will fail with a data error. This is because Seek was passing the same buffer that Read was using to store data from the source stream. Once zlib did a flush, it overwrote the source data.
The patch fix_decompress_seek.patch fixes this by utilizing an 8 KB stack buffer in Seek instead of FBuffer.
While fixing this I also noticed that paszlib doesn't compile when using the ZLIB_DEBUG define. This was because some of the debug code calls IntToStr, but SysUtils was not included. Furthermore the Assert function was redefined which caused issues, so I removed it because there is no reason not to use the RTL Assert. These changes can be found in fix_zlib_debug.patch.