Bug #73968 [Asn]: Premature failing of XBM reading

From: Date: Sat, 21 Jan 2017 12:10:00 +0000
Subject: Bug #73968 [Asn]: Premature failing of XBM reading
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206816@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 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: This issue had been reported against GD with <https://github.com/libgd/libgd/issues/109>. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#206816) next »