summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2014-04-13 15:22:21 -0700
committerStanislav Malyshev <stas@php.net>2014-04-13 15:23:32 -0700
commitfe72caa6e5ae18be1ebdbb97a3b910fce5b2dc6f (patch)
tree54af8c360932d1c8a47aa9aac962f57bddaab2b6
parentbf3edbada68cb99f4c67f60fe113a6cf0b44e0fa (diff)
parent1010200da5da81642bec89d9c90d001478e3554d (diff)
downloadphp-git-fe72caa6e5ae18be1ebdbb97a3b910fce5b2dc6f.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fixed bug #67024 - getimagesize should recognize BMP files with negative height
-rw-r--r--NEWS2
-rw-r--r--ext/standard/image.c1
-rw-r--r--ext/standard/tests/image/getimagesize.phpt17
-rw-r--r--ext/standard/tests/image/image_type_to_mime_type.phpt4
-rw-r--r--ext/standard/tests/image/test-1pix.bmpbin0 -> 58 bytes
5 files changed, 22 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index cb6c695854..b08e875d3b 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ PHP NEWS
UNIX sockets). (Mike)
. Fixed bug #66182 (exit in stream filter produces segfault). (Mike)
. Fixed bug #66736 (fpassthru broken). (Mike)
+ . Fixed bug #67024 (getimagesize should recognize BMP files with negative
+ height). (Gabor Buella)
. Fixed bug #67043 (substr_compare broke by previous change) (Tjerk)
- Embed:
diff --git a/ext/standard/image.c b/ext/standard/image.c
index 27f60c95a7..816de44d4c 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -163,6 +163,7 @@ static struct gfxinfo *php_handle_bmp (php_stream * stream TSRMLS_DC)
result = (struct gfxinfo *) ecalloc (1, sizeof(struct gfxinfo));
result->width = (((unsigned int)dim[ 7]) << 24) + (((unsigned int)dim[ 6]) << 16) + (((unsigned int)dim[ 5]) << 8) + ((unsigned int) dim[ 4]);
result->height = (((unsigned int)dim[11]) << 24) + (((unsigned int)dim[10]) << 16) + (((unsigned int)dim[ 9]) << 8) + ((unsigned int) dim[ 8]);
+ result->height = abs((int32_t)result->height);
result->bits = (((unsigned int)dim[15]) << 8) + ((unsigned int)dim[14]);
} else {
return NULL;
diff --git a/ext/standard/tests/image/getimagesize.phpt b/ext/standard/tests/image/getimagesize.phpt
index 6cd8275e06..04ddd8c82b 100644
--- a/ext/standard/tests/image/getimagesize.phpt
+++ b/ext/standard/tests/image/getimagesize.phpt
@@ -23,7 +23,22 @@ GetImageSize()
var_dump($result);
?>
--EXPECT--
-array(12) {
+array(13) {
+ ["test-1pix.bmp"]=>
+ array(6) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(6)
+ [3]=>
+ string(20) "width="1" height="1""
+ ["bits"]=>
+ int(24)
+ ["mime"]=>
+ string(14) "image/x-ms-bmp"
+ }
["test1bpix.bmp"]=>
array(6) {
[0]=>
diff --git a/ext/standard/tests/image/image_type_to_mime_type.phpt b/ext/standard/tests/image/image_type_to_mime_type.phpt
index d83ab8d146..9f7ffa1aa3 100644
--- a/ext/standard/tests/image/image_type_to_mime_type.phpt
+++ b/ext/standard/tests/image/image_type_to_mime_type.phpt
@@ -25,7 +25,9 @@ image_type_to_mime_type()
var_dump($result);
?>
--EXPECT--
-array(12) {
+array(13) {
+ ["test-1pix.bmp"]=>
+ string(14) "image/x-ms-bmp"
["test1bpix.bmp"]=>
string(14) "image/x-ms-bmp"
["test1pix.bmp"]=>
diff --git a/ext/standard/tests/image/test-1pix.bmp b/ext/standard/tests/image/test-1pix.bmp
new file mode 100644
index 0000000000..ec68a571cc
--- /dev/null
+++ b/ext/standard/tests/image/test-1pix.bmp
Binary files differ