unsigned long
scene;
+ const unsigned long
+ max_scenes = 1024UL;
+
ImageCharacteristics
characteristics;
*/
write_dcx=MagickTrue;
(void) WriteBlobLSBLong(image,0x3ADE68B1L);
- page_table=MagickAllocateResourceLimitedMemory(ExtendedSignedIntegralType *,
- 1024*sizeof(ExtendedSignedIntegralType));
+ page_table=MagickAllocateResourceLimitedClearedArray(ExtendedSignedIntegralType *,
+ max_scenes+1,
+ sizeof(ExtendedSignedIntegralType));
if (page_table == (ExtendedSignedIntegralType *) NULL)
ThrowPCXWriterException(ResourceLimitError,MemoryAllocationFailed,image);
- for (scene=0; scene < 1024; scene++)
+ for (scene=0; scene < max_scenes; scene++)
(void) WriteBlobLSBLong(image,0x00000000L);
}
adjoin=(image_info->adjoin) && (image->next != (const Image *) NULL) && (write_dcx);
/*
Dump colormap to file.
*/
- pcx_colormap=MagickAllocateResourceLimitedMemory(unsigned char *,3*256);
+ pcx_colormap=MagickAllocateResourceLimitedClearedArray(unsigned char *,3,256);
if (pcx_colormap == (unsigned char *) NULL)
ThrowPCXWriterException(ResourceLimitError,MemoryAllocationFailed,image);
- for (i=0; i < (3*256); i++)
- pcx_colormap[i]=0;
q=pcx_colormap;
if (image->storage_class == PseudoClass)
for (i=0; i < (long) image->colors; i++)
for (i=0; i < 58; i++)
(void) WriteBlobByte(image,'\0');
/* Allocate memory for one pixel row. */
- pcx_pixels=MagickAllocateResourceLimitedArray(unsigned char *,bytes_per_line,pcx_info.planes);
+ pcx_pixels=MagickAllocateResourceLimitedClearedArray(unsigned char *,
+ bytes_per_line,
+ pcx_info.planes);
if (pcx_pixels == (unsigned char *) NULL)
ThrowPCXWriterException(ResourceLimitError,MemoryAllocationFailed,image);
q=pcx_pixels;
if (image->next == (Image *) NULL)
break;
image=SyncNextImageInList(image);
- status=MagickMonitorFormatted(scene++,image_list_length,
+ status=MagickMonitorFormatted(scene++,Min(max_scenes,image_list_length),
&image->exception,SaveImagesText,
image->filename);
if (status == False)
break;
- if (scene >= 1023)
+ if (scene >= max_scenes-1)
break;
} while (adjoin);
if (adjoin)
/*
Write the DCX page table.
*/
+ if (logging && write_dcx && image_list_length > max_scenes)
+ (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+ "WARNING: DCX truncated to %lu scenes!",
+ max_scenes-1);
page_table[scene+1]=0;
(void) SeekBlob(image,0L,SEEK_SET);
(void) WriteBlobLSBLong(image,0x3ADE68B1L);