Skip to content

Commit 194b480

Browse files
author
Scott MacVicar
committed
Fixed bug #54723 - getimagesize() doesn't check the full ico signature and misreports mpg files
1 parent 155972b commit 194b480

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/standard/image.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ PHPAPI const char php_sig_jp2[12] = {(char)0x00, (char)0x00, (char)0x00, (char)0
5151
(char)0x6a, (char)0x50, (char)0x20, (char)0x20,
5252
(char)0x0d, (char)0x0a, (char)0x87, (char)0x0a};
5353
PHPAPI const char php_sig_iff[4] = {'F','O','R','M'};
54-
PHPAPI const char php_sig_ico[3] = {(char)0x00, (char)0x00, (char)0x01};
54+
PHPAPI const char php_sig_ico[4] = {(char)0x00, (char)0x00, (char)0x01, (char)0x00};
5555

5656
/* REMEMBER TO ADD MIME-TYPE TO FUNCTION php_image_type_to_mime_type */
5757
/* PCX must check first 64bytes and byte 0=0x0a and byte2 < 0x06 */
@@ -1265,7 +1265,7 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC)
12651265
return IMAGE_FILETYPE_TIFF_MM;
12661266
} else if (!memcmp(filetype, php_sig_iff, 4)) {
12671267
return IMAGE_FILETYPE_IFF;
1268-
} else if (!memcmp(filetype, php_sig_ico, 3)) {
1268+
} else if (!memcmp(filetype, php_sig_ico, 4)) {
12691269
return IMAGE_FILETYPE_ICO;
12701270
}
12711271

0 commit comments

Comments
 (0)