1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 03:32:20 +02:00

Merge branch 'PHP-7.1'

* PHP-7.1:
  Fix #73968: Premature failing of XBM reading
This commit is contained in:
Christoph M. Becker
2017-01-21 13:20:47 +01:00
5 changed files with 21 additions and 7 deletions

View File

@@ -78,7 +78,7 @@ gdImagePtr gdImageCreateFromXbm(FILE * fd)
max_bit = 32768;
}
if (max_bit) {
bytes = (width * height / 8) + 1;
bytes = (width + 7) / 8 * height;
if (!bytes) {
return 0;
}

View File

@@ -0,0 +1,15 @@
--TEST--
Bug #73968 (Premature failing of XBM reading)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
$im = imagecreatefromxbm(__DIR__ . DIRECTORY_SEPARATOR . 'bug73968.xbm');
var_dump($im);
?>
===DONE===
--EXPECTF--
resource(%d) of type (gd)
===DONE===

View File

@@ -0,0 +1,5 @@
#define test_width 10
#define test_height 10
static unsigned char test_bits[] = {
0xFF, 0x03, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00,
0xFF, 0x03, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00};

View File

@@ -11,9 +11,6 @@ $im = imagecreatefromxbm(dirname(__FILE__) . '/libgd00094私はガラスを食
var_dump($im);
?>
--EXPECTF--
Warning: imagecreatefromxbm(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %slibgd00094-mb.php on line %d
Warning: imagecreatefromxbm(): '%slibgd00094私はガラスを食べられます.xbm' is not a valid XBM file in %slibgd00094-mb.php on line %d
bool(false)

View File

@@ -11,9 +11,6 @@ $im = imagecreatefromxbm(dirname(__FILE__) . '/libgd00094.xbm');
var_dump($im);
?>
--EXPECTF--
Warning: imagecreatefromxbm(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %slibgd00094.php on line %d
Warning: imagecreatefromxbm(): '%slibgd00094.xbm' is not a valid XBM file in %slibgd00094.php on line %d
bool(false)