]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Tue, 27 Feb 2018 01:32:42 +0000 (20:32 -0500)
committerCristy <urban-warrior@imagemagick.org>
Tue, 27 Feb 2018 01:32:42 +0000 (20:32 -0500)
coders/pict.c

index f5dd88cd8ac0ed8b65ed7292caa017983dd52aed..7e1d0e9af34b7108244871d05439ad90607ffc0f 100644 (file)
@@ -801,8 +801,9 @@ static MagickBooleanType ReadRectangle(Image *image,PICTRectangle *rectangle)
   rectangle->left=(short) ReadBlobMSBShort(image);
   rectangle->bottom=(short) ReadBlobMSBShort(image);
   rectangle->right=(short) ReadBlobMSBShort(image);
-  if ((EOFBlob(image) != MagickFalse) || (rectangle->left > rectangle->right) ||
-      (rectangle->top > rectangle->bottom))
+  if ((EOFBlob(image) != MagickFalse) || 
+      ((rectangle->bottom-rectangle->top) > 0) ||
+      ((rectangle->right-rectangle->left) > 0))
     return(MagickFalse);
   return(MagickTrue);
 }
@@ -1039,6 +1040,9 @@ static Image *ReadPICTImage(const ImageInfo *image_info,
               }
             else
               for (i=0; i < (int) height; i++)
+              {
+                if (EOFBlob(image) != MagickFalse)
+                  break;
                 if (length > 200)
                   {
                     for (j=0; j < (ssize_t) ReadBlobMSBShort(image); j++)
@@ -1049,6 +1053,7 @@ static Image *ReadPICTImage(const ImageInfo *image_info,
                   for (j=0; j < (ssize_t) ReadBlobByte(image); j++)
                     if (ReadBlobByte(image) == EOF)
                       break;
+              }
             break;
           }
           case 0x1b:
@@ -1423,6 +1428,9 @@ static Image *ReadPICTImage(const ImageInfo *image_info,
       continue;
     if (code == 0x8200)
       {
+        char
+          filename[MaxTextExtent];
+
         FILE
           *file;
 
@@ -1442,7 +1450,9 @@ static Image *ReadPICTImage(const ImageInfo *image_info,
         read_info=CloneImageInfo(image_info);
         SetImageInfoBlob(read_info,(void *) NULL,0);
         file=(FILE *) NULL;
-        unique_file=AcquireUniqueFileResource(read_info->filename);
+        unique_file=AcquireUniqueFileResource(filename);
+        (void) FormatLocaleString(read_info->filename,MaxTextExtent,"jpeg:%s",
+          filename);
         if (unique_file != -1)
           file=fdopen(unique_file,"wb");
         if ((unique_file == -1) || (file == (FILE *) NULL))
@@ -1480,7 +1490,7 @@ static Image *ReadPICTImage(const ImageInfo *image_info,
         (void) fclose(file);
         (void) close(unique_file);
         tile_image=ReadImage(read_info,exception);
-        (void) RelinquishUniqueFileResource(read_info->filename);
+        (void) RelinquishUniqueFileResource(filename);
         read_info=DestroyImageInfo(read_info);
         if (tile_image == (Image *) NULL)
           continue;