% July 2016 %
% %
% %
-% Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
count=(ssize_t) sscanf(buffer,"PG%[ \t]%2s%[ \t+-]%d%[ \t]%d%[ \t]%d",sans,
endian,sign,&precision,sans,&width,sans,&height);
+ if (count != 8)
+ ThrowReaderException(CorruptImageError,"ImproperImageHeader");
image->depth=(size_t) precision;
if (LocaleCompare(endian,"ML") == 0)
image->endian=MSBEndian;
pixels=(const unsigned char *) ReadBlobStream(image,length,
GetQuantumPixels(quantum_info),&count);
if (count != (ssize_t) length)
- ThrowReaderException(CorruptImageError,"UnableToReadImageData");
+ break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
GrayQuantum,pixels,exception);
+ if (status == MagickFalse)
+ break;
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
if (SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,image->rows) == MagickFalse)
status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
- (void) FormatLocaleString(buffer,MagickPathExtent,"PG ML + %ld %lu %lu\n",
- image->depth,image->columns,image->rows);
+ (void) FormatLocaleString(buffer,MagickPathExtent,"PG ML + %g %g %g\n",
+ (double) image->depth,(double) image->columns,(double) image->rows);
(void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer);
(void) TransformImageColorspace(image,sRGBColorspace,exception);
quantum_info=AcquireQuantumInfo(image_info,image);
- if(quantum_info == (QuantumInfo *) NULL)
+ if (quantum_info == (QuantumInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
pixels=(unsigned char *) GetQuantumPixels(quantum_info);
for (y=0; y < (ssize_t) image->rows; y++)