iliaa           Mon Dec 25 23:43:10 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/exif   exif.c 
  Log:
  
  Allocation safety checks
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/exif/exif.c?r1=1.173.2.5.2.6&r2=1.173.2.5.2.7&diff_format=u
Index: php-src/ext/exif/exif.c
diff -u php-src/ext/exif/exif.c:1.173.2.5.2.6 
php-src/ext/exif/exif.c:1.173.2.5.2.7
--- php-src/ext/exif/exif.c:1.173.2.5.2.6       Mon Dec 25 16:48:17 2006
+++ php-src/ext/exif/exif.c     Mon Dec 25 23:43:10 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: exif.c,v 1.173.2.5.2.6 2006/12/25 16:48:17 iliaa Exp $ */
+/* $Id: exif.c,v 1.173.2.5.2.7 2006/12/25 23:43:10 iliaa Exp $ */
 
 /*  ToDos
  *
@@ -139,7 +139,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION "1.4 $Id: exif.c,v 1.173.2.5.2.6 2006/12/25 16:48:17 
iliaa Exp $"
+#define EXIF_VERSION "1.4 $Id: exif.c,v 1.173.2.5.2.7 2006/12/25 23:43:10 
iliaa Exp $"
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -3590,7 +3590,7 @@
                                                                
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 
0x%04X", ImageInfo->Thumbnail.data ? "Ignore" : "Read", 
ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
 #endif
                                                                if 
(!ImageInfo->Thumbnail.data) {
-                                                                       
ImageInfo->Thumbnail.data = emalloc(ImageInfo->Thumbnail.size);
+                                                                       
ImageInfo->Thumbnail.data = safe_emalloc(ImageInfo->Thumbnail.size, 1, 0);
                                                                        
php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
                                                                        fgot = 
php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, 
ImageInfo->Thumbnail.size);
                                                                        if 
(fgot < ImageInfo->Thumbnail.size) {
@@ -3623,7 +3623,7 @@
                                        exif_error_docref(NULL EXIFERR_CC, 
ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data 
? "Ignore" : "Read", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
 #endif
                                        if (!ImageInfo->Thumbnail.data && 
ImageInfo->Thumbnail.offset && ImageInfo->Thumbnail.size && 
ImageInfo->read_thumbnail) {
-                                               ImageInfo->Thumbnail.data = 
emalloc(ImageInfo->Thumbnail.size);
+                                               ImageInfo->Thumbnail.data = 
safe_emalloc(ImageInfo->Thumbnail.size, 1, 0);
                                                
php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET);
                                                fgot = 
php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, 
ImageInfo->Thumbnail.size);
                                                if (fgot < 
ImageInfo->Thumbnail.size) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to