From: Dirk Lemstra Date: Tue, 16 Jul 2019 19:31:03 +0000 (+0200) Subject: Enlarge buffer to make it possible to read odd extent. X-Git-Tag: 7.0.8-54~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73dd03cfb57f8f8c0a732fa062b9966ec7bf2f91;p=imagemagick Enlarge buffer to make it possible to read odd extent. --- diff --git a/coders/ps.c b/coders/ps.c index 9fc8b4afe..7b22a5146 100644 --- a/coders/ps.c +++ b/coders/ps.c @@ -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)