Bug #79615 [Asn->Csd]: Wrong GIF header written in GD GIFEncode

From: Date: Fri, 22 May 2020 07:23:50 +0000
Subject: Bug #79615 [Asn->Csd]: Wrong GIF header written in GD GIFEncode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227120@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79615&edit=1 ID: 79615 Updated by: cmb@php.net Reported by: sageptr at gmail dot com Summary: Wrong GIF header written in GD GIFEncode -Status: Assigned +Status: Closed Type: Bug Package: GD related PHP Version: Irrelevant Assigned To: cmb Block user comment: N Private report: N New Comment: Automatic comment on behalf of cmbecker69@gmx.de Revision: http://git.php.net/?p=php-src.git;a=commit;h=d4bd6fb491ccaf70006d6f671755126b47a71bcb Log: Fix #79615: Wrong GIF header written in GD GIFEncode Previous Comments: ------------------------------------------------------------------------ [2020-05-20 13:32:01] sageptr at gmail dot com The following patch has been added/updated: Patch Name: gd_gif_out.c.patch Revision: 1589981521 URL: https://bugs.php.net/patch-display.php?bug=79615&patch=gd_gif_out.c.patch&revision=1589981521 ------------------------------------------------------------------------ [2020-05-20 13:31:46] sageptr at gmail dot com Description: ------------ In file https://github.com/php/php-src/blob/master/ext/gd/libgd/gd_gif_out.c#L336, line 336: B |= (Resolution - 1) << 5; Should be: B |= (Resolution - 1) << 4; This bug was fixed in the original libgd: https://github.com/libgd/libgd/commit/db10f301fff50d8f65ebbbedb57b79433c2dc8a3 But still presents in PHP version of GD Test script: --------------- <?php $im = imagecreate(3, 3); // 3x3, 9 colors, 4 bits per pixel for ($x = 0; $x < 3; $x++) for ($y = 0; $y < 3; $y++) imagesetpixel($im, $x, $y, imagecolorallocate($im, $x, $y, 0)); ob_start(); imagegif($im); echo decbin(ord(ob_get_clean()[0xA])); Expected result: ---------------- Should output "10110011" (1 011 0 011, as Resolution bits and BitsPerPixel bits should match) Actual result: -------------- Outputs "11100011" (1 110 0 011, Resolutions bits are shifted 1 bit left) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79615&edit=1

« previous php.bugs (#227120) next »