]> granicus.if.org Git - imagemagick/commitdiff
Enlarge buffer to make it possible to read odd extent.
authorDirk Lemstra <dirk@lemstra.org>
Tue, 16 Jul 2019 19:31:03 +0000 (21:31 +0200)
committerDirk Lemstra <dirk@lemstra.org>
Tue, 16 Jul 2019 19:31:03 +0000 (21:31 +0200)
coders/ps.c

index 9fc8b4afee21b1e57deee20fd2af4ce3c7bfcb6b..7b22a5146a7d1aa6c0874d3e8c8faba8d33d8d2a 100644 (file)
@@ -415,9 +415,10 @@ static void ReadPSInfo(const ImageInfo *image_info,Image *image,
           continue;
         if ((MagickSizeType) extent > GetBlobSize(image))
           continue;
-        ps_info->photoshop_profile=AcquireStringInfo((size_t) extent);
+        length=(size_t) extent;
+        ps_info->photoshop_profile=AcquireStringInfo(length+1U);
         q=GetStringInfoDatum(ps_info->photoshop_profile);
-        while (extent > 1)
+        while (extent > 0)
         {
           c=ProfileInteger(&buffer,hex_digits);
           if (c == EOF)
@@ -425,6 +426,7 @@ static void ReadPSInfo(const ImageInfo *image_info,Image *image,
           *q++=(unsigned char) c;
           extent-=2;
         }
+        SetStringInfoLength(ps_info->icc_profile,length);
         continue;
       }
     if (image_info->page != (char *) NULL)