From 7e5d1daafe9f9ee96028d51b33ddc734493fb296 Mon Sep 17 00:00:00 2001 From: cristy Date: Sun, 28 Dec 2014 00:40:02 +0000 Subject: [PATCH] --- coders/pdb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/coders/pdb.c b/coders/pdb.c index d5939aba7..36d3a9b1c 100644 --- a/coders/pdb.c +++ b/coders/pdb.c @@ -339,14 +339,14 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception) pdb_info.modify_number=ReadBlobMSBLong(image); pdb_info.application_info=ReadBlobMSBLong(image); pdb_info.sort_info=ReadBlobMSBLong(image); - count=ReadBlob(image,4,(unsigned char *) pdb_info.type); - count=ReadBlob(image,4,(unsigned char *) pdb_info.id); - if ((count == 0) || (memcmp(pdb_info.type,"vIMG",4) != 0) || - (memcmp(pdb_info.id,"View",4) != 0)) - ThrowReaderException(CorruptImageError,"ImproperImageHeader"); + (void) ReadBlob(image,4,(unsigned char *) pdb_info.type); + (void) ReadBlob(image,4,(unsigned char *) pdb_info.id); pdb_info.seed=ReadBlobMSBLong(image); pdb_info.next_record=ReadBlobMSBLong(image); pdb_info.number_records=(short) ReadBlobMSBShort(image); + if ((memcmp(pdb_info.type,"vIMG",4) != 0) || + (memcmp(pdb_info.id,"View",4) != 0)) + ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if (pdb_info.next_record != 0) ThrowReaderException(CoderError,"MultipleRecordListNotSupported"); /* @@ -808,9 +808,9 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image, if (image->columns % 16) pdb_image.width=(short) (16*(image->columns/16+1)); pdb_image.height=(short) image->rows; - packets=((bits_per_pixel*image->columns+7)/8)*image->rows; + packets=((bits_per_pixel*image->columns+7)/8); runlength=(unsigned char *) AcquireQuantumMemory(2UL*packets, - sizeof(*runlength)); + image->rows*sizeof(*runlength)); if (runlength == (unsigned char *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); buffer=(unsigned char *) AcquireQuantumMemory(256UL,sizeof(*buffer)); -- 2.40.0