summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-05-22 09:18:42 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-05-22 09:19:05 +0200
commitda801ba5e3553f4c217d2528b36a5977ee9a90ed (patch)
tree29af080a01eaf5bb6bc4e94eaa07dd7852c76bd2
parent405bea47509093d777d3a56cdb76de5e50293c78 (diff)
parentd4bd6fb491ccaf70006d6f671755126b47a71bcb (diff)
downloadphp-git-da801ba5e3553f4c217d2528b36a5977ee9a90ed.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79615: Wrong GIF header written in GD GIFEncode
-rw-r--r--NEWS3
-rw-r--r--ext/gd/libgd/gd_gif_out.c2
-rw-r--r--ext/gd/tests/bug79615.phpt20
3 files changed, 24 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 29d1a22a4e..eb88651544 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,9 @@ PHP NEWS
- FFI:
. Fixed bug #79571 (FFI: var_dumping unions may segfault). (cmb)
+- GD:
+ . Fixed bug #79615 (Wrong GIF header written in GD GIFEncode). (sageptr, cmb)
+
- Opcache:
. Fixed bug #79588 (Boolean opcache settings ignore on/off values). (cmb)
. Fixed bug #79548 (Preloading segfault with inherited method using static
diff --git a/ext/gd/libgd/gd_gif_out.c b/ext/gd/libgd/gd_gif_out.c
index 912769128b..e721992b48 100644
--- a/ext/gd/libgd/gd_gif_out.c
+++ b/ext/gd/libgd/gd_gif_out.c
@@ -333,7 +333,7 @@ GIFEncode(gdIOCtxPtr fp, int GWidth, int GHeight, int GInterlace, int Background
/*
* OR in the resolution
*/
- B |= (Resolution - 1) << 5;
+ B |= (Resolution - 1) << 4;
/*
* OR in the Bits per Pixel
diff --git a/ext/gd/tests/bug79615.phpt b/ext/gd/tests/bug79615.phpt
new file mode 100644
index 0000000000..b7cf9175c5
--- /dev/null
+++ b/ext/gd/tests/bug79615.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #79615 (Wrong GIF header written in GD GIFEncode)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?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]));
+?>
+--EXPECT--
+10110011