Bug #78527 [Fbk->Opn]: zlib deflate bug with windowBits == 8

From: Date: Thu, 12 Sep 2019 10:12:59 +0000
Subject: Bug #78527 [Fbk->Opn]: zlib deflate bug with windowBits == 8
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222702@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78527&edit=1 ID: 78527 User updated by: wcode404 at gmail dot com Reported by: wcode404 at gmail dot com Summary: zlib deflate bug with windowBits == 8 -Status: Feedback +Status: Open Type: Bug Package: Zlib related Operating System: linux PHP Version: 7.3.9 Block user comment: N Private report: N New Comment: Maybe you should give a warning when trying to initialize compression with a window size of 256 bytes and warn that a 512 byte window is actually being created. Test script: --------------- $filename = tempnam(sys_get_temp_dir(), 'zlib'); $expected = 'foo'; // write to file the compress content $context = deflate_init(ZLIB_ENCODING_DEFLATE, ['window' => 8]); file_put_contents($filename, deflate_add($context, $expected)); // read content from file and uncompress it $context = inflate_init(ZLIB_ENCODING_DEFLATE, ['window' => 9]); $actual = inflate_add($context, file_get_contents($filename)); var_dump($expected === $actual); Actual result: -------------- bool(true) Previous Comments: ------------------------------------------------------------------------ [2019-09-12 09:49:26] nikic@php.net What is the desired change here, given that zlib does not support this? The current behavior seems appropriate here. ------------------------------------------------------------------------ [2019-09-12 09:43:34] wcode404 at gmail dot com Description: ------------ 256-byte windows are broken https://github.com/madler/zlib/issues/171 Test script: --------------- $filename = tempnam(sys_get_temp_dir(), 'zlib'); $expected = 'foo'; // write to file the compress content $context = deflate_init(ZLIB_ENCODING_DEFLATE, ['window' => 8]); file_put_contents($filename, deflate_add($context, $expected)); // read content from file and uncompress it $context = inflate_init(ZLIB_ENCODING_DEFLATE, ['window' => 8]); $actual = inflate_add($context, file_get_contents($filename)); var_dump($expected === $actual); Expected result: ---------------- bool(true) Actual result: -------------- inflate_add(): data error ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78527&edit=1

« previous php.bugs (#222702) next »