iliaa Thu Nov 7 11:37:48 2002 EDT Modified files: /php4/ext/standard image.c Log: Fixed a crash in image_type_to_mime_type(), when a non integer value is passed to the function. Fixed Width/Height detection of bmp files on big endian systems. Added bit depth detection for bmp files. Index: php4/ext/standard/image.c diff -u php4/ext/standard/image.c:1.69 php4/ext/standard/image.c:1.70 --- php4/ext/standard/image.c:1.69 Wed Sep 18 16:37:24 2002 +++ php4/ext/standard/image.c Thu Nov 7 11:37:46 2002 @@ -16,7 +16,7 @@ | Marcus Boerger <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: image.c,v 1.69 2002/09/18 20:37:24 iliaa Exp $ */ +/* $Id: image.c,v 1.70 2002/11/07 16:37:46 iliaa Exp $ */ /* * Based on Daniel Schmitt's imageinfo.c which carried the following * Copyright notice. @@ -168,15 +168,23 @@ struct { unsigned long in_width, in_height; + unsigned short trash, bits; } dim; result = (struct gfxinfo *) ecalloc (1, sizeof(struct gfxinfo)); php_stream_read(stream, temp, sizeof(temp)); + +#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 = 0; + result->bits = dim.bits; result->channels = 0; return result; @@ -836,7 +844,7 @@ if ((arg_c!=1) || zend_get_parameters_ex(arg_c, &p_image_type) == FAILURE) { WRONG_PARAM_COUNT; } - zval_dtor(*p_image_type); + convert_to_long_ex(p_image_type); ZVAL_STRING(return_value, (char*)php_image_type_to_mime_type(Z_LVAL_PP(p_image_type)), 1); } /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php