]> granicus.if.org Git - imagemagick/commitdiff
Added missing memory checks.
authorDirk Lemstra <dirk@git.imagemagick.org>
Mon, 27 Aug 2018 05:23:44 +0000 (07:23 +0200)
committerDirk Lemstra <dirk@git.imagemagick.org>
Mon, 27 Aug 2018 05:23:44 +0000 (07:23 +0200)
coders/heic.c

index 2f2bd9b899442a90eda7cbcd626f39792cca3b09..419ca9845c56382fd9846a4cf7bd902ff17a6f75 100644 (file)
@@ -228,16 +228,23 @@ static Image *ReadHEICImage(const ImageInfo *image_info,
             "InsufficientImageDataInFile");
         }
       exif_buffer=AcquireMagickMemory(exif_size);
-      error=heif_image_handle_get_metadata(image_handle,exif_id,exif_buffer);
-      if (error.code == 0)
+      if (exif_buffer != NULL)
         {
-          StringInfo
-            *profile;
+          error=heif_image_handle_get_metadata(image_handle,
+            exif_id,exif_buffer);
+          if (error.code == 0)
+            {
+              StringInfo
+                *profile;
 
-          profile=BlobToStringInfo(exif_buffer,exif_size);
-          SetImageProfile(image,"exif",profile,exception);
-          profile=DestroyStringInfo(profile);
-      }
+              profile=BlobToStringInfo(exif_buffer,exif_size);
+              if (profile != (StringInfo*) NULL)
+                {
+                  SetImageProfile(image,"exif",profile,exception);
+                  profile=DestroyStringInfo(profile);
+                }
+            }
+        }
       exif_buffer=RelinquishMagickMemory(exif_buffer);
   }
   /*