Bug #73968 [Asn->Csd]: Premature failing of XBM reading
| From: | cmb@php.net | Date: | Sat, 21 Jan 2017 12:28:42 +0000 |
| Subject: | Bug #73968 [Asn->Csd]: Premature failing of XBM reading | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206817@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73968&edit=1
ID: 73968
Updated by: cmb@php.net
Reported by: cmb@php.net
Summary: Premature failing of XBM reading
-Status: Assigned
+Status: Closed
Type: Bug
Package: GD related
Operating System: *
PHP Version: 7.0Git-2017-01-20 (snap)
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=f67d599a0179d0895170c77188847ae60b497714
Log: Fix #73968: Premature failing of XBM reading
Previous Comments:
------------------------------------------------------------------------
[2017-01-21 12:09:59] cmb@php.net
This issue had been reported against GD with
<https://github.com/libgd/libgd/issues/109>.
------------------------------------------------------------------------
[2017-01-21 00:02:45] cmb@php.net
Description:
------------
libgd's XBM reader calculates the maximum number of image data
bytes to read in advance. However, it doesn't take into account
the line padding, so reading of XBM files with a width that is not
a multiple of 8 is likely to fail, for instance with the following
test.xbm:
#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};
Test script:
---------------
<?php
$im = imagecreatefromxbm(__DIR__ . '/test.xbm');
var_dump($im);
Expected result:
----------------
resource(%d) of type (gd)
Actual result:
--------------
Warning: imagecreatefromxbm(): EOF before image was complete in %s on line %d
Warning: imagecreatefromxbm(): '%s' is not a valid XBM file in %s on line %d
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73968&edit=1