]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 1 Dec 2014 23:11:58 +0000 (23:11 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 1 Dec 2014 23:11:58 +0000 (23:11 +0000)
coders/sun.c

index 3ef2464acf6cc414dbe60b7c9fcaf18364d6dc56..40f0a8a9c56f5bd11ce33a4a08c3d549b047df04 100644 (file)
@@ -498,11 +498,13 @@ static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception)
     else
       if (image->storage_class == PseudoClass)
         {
+          if (bytes_per_line == 0)
+            bytes_per_line=image->columns;
           length=image->rows*(image->columns+image->columns % 2);
           if (((sun_info.type == RT_ENCODED) &&
                (length > (bytes_per_line*image->rows))) ||
               ((sun_info.type != RT_ENCODED) && (length > sun_info.length)))
-            ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+            ThrowReaderException(CorruptImageError,"UnableToReadImageData");
           for (y=0; y < (ssize_t) image->rows; y++)
           {
             q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
@@ -534,12 +536,14 @@ static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception)
           bytes_per_pixel=3;
           if (image->alpha_trait == BlendPixelTrait)
             bytes_per_pixel++;
+          if (bytes_per_line == 0)
+            bytes_per_line=bytes_per_pixel*image->columns;
           length=image->rows*((bytes_per_line*image->columns)+
             image->columns % 2);
           if (((sun_info.type == RT_ENCODED) &&
                (length > (bytes_per_line*image->rows))) ||
               ((sun_info.type != RT_ENCODED) && (length > sun_info.length)))
-            ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+            ThrowReaderException(CorruptImageError,"UnableToReadImageData");
           for (y=0; y < (ssize_t) image->rows; y++)
           {
             q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);