Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/modules/loaders/tiff Modified Files: evas_image_load_tiff.c Log Message: check dimensions for safety =================================================================== RCS file: /cvs/e/e17/libs/evas/src/modules/loaders/tiff/evas_image_load_tiff.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- evas_image_load_tiff.c 28 Oct 2006 03:02:22 -0000 1.6 +++ evas_image_load_tiff.c 5 Nov 2006 05:07:53 -0000 1.7 @@ -66,11 +66,11 @@ raster(TIFFRGBAImage_Extra * img, uint32 * rast, uint32 x, uint32 y, uint32 w, uint32 h) { - uint32 image_width, image_height; + int image_width, image_height; uint32 *pixel, pixel_value; int i, j, dy, rast_offset; DATA32 *buffer_pixel, *buffer = img->image->image->data; - int alpha_premult = (EXTRASAMPLE_UNASSALPHA==img->rgba.alpha); + int alpha_premult; image_width = img->image->image->w; image_height = img->image->image->h; @@ -82,6 +82,8 @@ /* I don't understand why, but that seems to be what's going on. */ /* libtiff needs better docs! */ + if (img->rgba.alpha == EXTRASAMPLE_UNASSALPHA) + alpha_premult = 1; for (i = y, rast_offset = 0; i > dy; i--, rast_offset--) { pixel = rast + (rast_offset * image_width); @@ -166,6 +168,12 @@ } if (tiff_image.alpha != EXTRASAMPLE_UNSPECIFIED) im->flags |= RGBA_IMAGE_HAS_ALPHA; + if ((tiff_image.width < 1) || (tiff_image.height < 1) || + (tiff_image.width > 8192) || (tiff_image.height > 8192)) + { + TIFFClose(tif); + return 0; + } im->image->w = tiff_image.width; im->image->h = tiff_image.height; @@ -235,6 +243,12 @@ } if (rgba_image.rgba.alpha != EXTRASAMPLE_UNSPECIFIED) im->flags |= RGBA_IMAGE_HAS_ALPHA; + if ((rgba_image.rgba.width != im->image->w) || + (rgba_image.rgba.height != im->image->h)) + { + TIFFClose(tif); + return 0; + } im->image->w = rgba_image.rgba.width; im->image->h = rgba_image.rgba.height; rgba_image.num_pixels = num_pixels = im->image->w * im->image->h; ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs