From: cristy Date: Fri, 16 Oct 2009 14:04:35 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~10512 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed5525230af20461366cdc5b8bbe0f7f9b166c44;p=imagemagick --- diff --git a/coders/pict.c b/coders/pict.c index c899f3b54..65535a8f8 100644 --- a/coders/pict.c +++ b/coders/pict.c @@ -1692,18 +1692,22 @@ static MagickBooleanType WritePICTImage(const ImageInfo *image_info, { (void) WriteBlobMSBShort(image,0xa1); (void) WriteBlobMSBShort(image,0x1f2); - (void) WriteBlobMSBShort(image,(unsigned short) (GetStringInfoLength(profile)+4)); + (void) WriteBlobMSBShort(image,(unsigned short) + (GetStringInfoLength(profile)+4)); (void) WriteBlobString(image,"8BIM"); - (void) WriteBlob(image,GetStringInfoLength(profile),GetStringInfoDatum(profile)); + (void) WriteBlob(image,GetStringInfoLength(profile), + GetStringInfoDatum(profile)); } profile=GetImageProfile(image,"icc"); if (profile != (StringInfo *) NULL) { (void) WriteBlobMSBShort(image,0xa1); (void) WriteBlobMSBShort(image,0xe0); - (void) WriteBlobMSBShort(image,(unsigned short) (GetStringInfoLength(profile)+4)); + (void) WriteBlobMSBShort(image,(unsigned short) + (GetStringInfoLength(profile)+4)); (void) WriteBlobMSBLong(image,0x00000000UL); - (void) WriteBlob(image,GetStringInfoLength(profile),GetStringInfoDatum(profile)); + (void) WriteBlob(image,GetStringInfoLength(profile), + GetStringInfoDatum(profile)); (void) WriteBlobMSBShort(image,0xa1); (void) WriteBlobMSBShort(image,0xe0); (void) WriteBlobMSBShort(image,4); diff --git a/coders/png.c b/coders/png.c index e5cdc404e..c45587b4e 100644 --- a/coders/png.c +++ b/coders/png.c @@ -1712,7 +1712,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, PNG_LIBPNG_VER_STRING); #endif - quantum_info = NULL; + quantum_info = (QuantumInfo *) NULL; image=mng_info->image; /* @@ -2272,9 +2272,6 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, /* Convert PNG pixels to pixel packets. */ - quantum_info=AcquireQuantumInfo(image_info,image); - if (quantum_info == (QuantumInfo *) NULL) - ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); if (setjmp(ping->jmpbuf)) { /* @@ -2299,6 +2296,9 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, } return(GetFirstImageInList(image)); } + quantum_info=AcquireQuantumInfo(image_info,image); + if (quantum_info == (QuantumInfo *) NULL) + ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); if (image->storage_class == DirectClass) for (pass=0; pass < num_passes; pass++) { @@ -6276,6 +6276,7 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, AcquireSemaphoreInfo(&png_semaphore); #endif + quantum_info = (QuantumInfo *) NULL; image_colors=image->colors; image_depth=image->depth; image_matte=image->matte; @@ -7407,9 +7408,6 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, /* Initialize image scanlines. */ - quantum_info=AcquireQuantumInfo(image_info,image); - if (quantum_info == (QuantumInfo *) NULL) - ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); if (setjmp(ping->jmpbuf)) { /* @@ -7429,6 +7427,9 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, #endif return(MagickFalse); } + quantum_info=AcquireQuantumInfo(image_info,image); + if (quantum_info == (QuantumInfo *) NULL) + ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); quantum_info->format=UndefinedQuantumFormat; quantum_info->depth=image_depth; num_passes=png_set_interlace_handling(ping);