]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 4 Apr 2015 23:58:14 +0000 (23:58 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 4 Apr 2015 23:58:14 +0000 (23:58 +0000)
coders/ps3.c

index 6481ba0c6059394e80b182cc6472c5c5b874ee94..687ebf347087401ae98fba1467ca5887b40d2a6f 100644 (file)
@@ -472,11 +472,15 @@ static MagickBooleanType WritePS3MaskImage(const ImageInfo *image_info,
     Note BeginData DSC comment for update later.
   */
   start=TellBlob(image);
+  if (start < 0)
+    ThrowWriterException(CorruptImageError,"ImproperImageHeader");
   (void) FormatLocaleString(buffer,MaxTextExtent,
     "%%%%BeginData:%13ld %s Bytes\n",0L,compression == NoCompression ?
     "ASCII" : "BINARY");
   (void) WriteBlobString(image,buffer);
   stop=TellBlob(image);
+  if (stop < 0)
+    ThrowWriterException(CorruptImageError,"ImproperImageHeader");
   /*
     Only lossless compressions for the mask.
   */
@@ -595,6 +599,8 @@ static MagickBooleanType WritePS3MaskImage(const ImageInfo *image_info,
   (void) WriteBlobByte(image,'\n');
   length=(size_t) (TellBlob(image)-stop);
   stop=TellBlob(image);
+  if (stop < 0)
+    ThrowWriterException(CorruptImageError,"ImproperImageHeader");
   offset=SeekBlob(image,start,SEEK_SET);
   if (offset < 0)
     ThrowWriterException(CorruptImageError,"ImproperImageHeader");
@@ -1176,11 +1182,15 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image,
       Remember position of BeginData comment so we can update it.
     */
     start=TellBlob(image);
+    if (start < 0)
+      ThrowWriterException(CorruptImageError,"ImproperImageHeader");
     (void) FormatLocaleString(buffer,MaxTextExtent,
       "%%%%BeginData:%13ld %s Bytes\n",0L,
       compression == NoCompression ? "ASCII" : "BINARY");
     (void) WriteBlobString(image,buffer);
     stop=TellBlob(image);
+    if (stop < 0)
+      ThrowWriterException(CorruptImageError,"ImproperImageHeader");
     (void) WriteBlobString(image,"DisplayImage\n");
     /*
       Translate, scale, and font point size.
@@ -1567,6 +1577,8 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image,
     */
     length=(size_t) (TellBlob(image)-stop);
     stop=TellBlob(image);
+    if (stop < 0)
+      ThrowWriterException(CorruptImageError,"ImproperImageHeader");
     offset=SeekBlob(image,start,SEEK_SET);
     if (offset < 0)
       ThrowWriterException(CorruptImageError,"ImproperImageHeader");