From f093a3119704fd6d349a9ee32b9f71cabe7d04c8 Mon Sep 17 00:00:00 2001 From: cristy <cristy@aa41f4f7-0bf4-0310-aa73-e5a19afd5a74> Date: Fri, 28 Nov 2014 17:13:45 +0000 Subject: Avoid a NULL dereference in ps handling GetStringInfoDatum(NULL) will likely crash. Avoid it. git-svn-id: https://subversion.imagemagick.org/subversion/ImageMagick/branches/ImageMagick-6@17117 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74 origin: http://trac.imagemagick.org/changeset/17117 diff --git a/coders/ps.c b/coders/ps.c index d5e1e01..efcdac9 100644 --- a/coders/ps.c +++ b/coders/ps.c @@ -643,11 +643,14 @@ static Image *ReadPSImage(const ImageInfo *image_info,ExceptionInfo *exception) continue; length=extent; profile=BlobToStringInfo((const void *) NULL,length); - p=GetStringInfoDatum(profile); - for (i=0; i < (ssize_t) length; i++) - *p++=(unsigned char) ProfileInteger(image,hex_digits); - (void) SetImageProfile(image,"8bim",profile); - profile=DestroyStringInfo(profile); + if (profile != (StringInfo *) NULL) + { + p=GetStringInfoDatum(profile); + for (i=0; i < (ssize_t) length; i++) + *p++=(unsigned char) ProfileInteger(image,hex_digits); + (void) SetImageProfile(image,"8bim",profile); + profile=DestroyStringInfo(profile); + } continue; } if (LocaleNCompare(BeginXMPPacket,command,strlen(BeginXMPPacket)) == 0) -- cgit v0.10.2