From 619fc2c3c0a3d91e0c8853e0b5471744b97c6e5b Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Tue, 12 Nov 2002 16:14:18 +0000 Subject: [PATCH] Data manipulation (for big endian transformation) should occur after the data has been read from file. --- ext/standard/image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/standard/image.c b/ext/standard/image.c index 806d11a2768..34247e0bcbb 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;