From: Ilia Alshanetsky Date: Tue, 12 Nov 2002 16:14:18 +0000 (+0000) Subject: Data manipulation (for big endian transformation) should occur after the X-Git-Tag: php-4.3.0RC1~73 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=619fc2c3c0a3d91e0c8853e0b5471744b97c6e5b;p=php Data manipulation (for big endian transformation) should occur after the data has been read from file. --- diff --git a/ext/standard/image.c b/ext/standard/image.c index 806d11a276..34247e0bcb 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -174,14 +174,14 @@ static struct gfxinfo *php_handle_bmp (php_stream * stream TSRMLS_DC) result = (struct gfxinfo *) ecalloc (1, sizeof(struct gfxinfo)); php_stream_read(stream, temp, sizeof(temp)); - + php_stream_read(stream, (char*) &dim, sizeof(dim)); + #ifdef WORDS_BIGENDIAN dim.in_width = (dim.in_width & 0x000000FF) << 24 | (dim.in_width & 0x0000FF00) << 8 | (dim.in_width & 0x00FF0000) >> 8 | (dim.in_width & 0xFF000000) >> 24; dim.in_height = (dim.in_height & 0x000000FF) << 24 | (dim.in_height & 0x0000FF00) << 8 | (dim.in_height & 0x00FF0000) >> 8 | (dim.in_height & 0xFF000000) >> 24; dim.bits = (dim.bits & 0x00FF) << 8 | (dim.bits & 0xFF00) >> 8; #endif - php_stream_read(stream, (char*) &dim, sizeof(dim)); result->width = dim.in_width; result->height = dim.in_height; result->bits = dim.bits;