mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Data manipulation (for big endian transformation) should occur after the
data has been read from file.
This commit is contained in:
parent
976c16b7c8
commit
619fc2c3c0
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user