" layer data is RAW");
row_size=GetPSDRowSize(image);
- pixels=(unsigned char *) AcquireQuantumMemory(row_size,sizeof(*pixels));
+ pixels=(unsigned char *) AcquireQuantumMemory(8*row_size,sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
" layer data is RLE compressed");
row_size=GetPSDRowSize(image);
- pixels=(unsigned char *) AcquireQuantumMemory(row_size,sizeof(*pixels));
+ pixels=(unsigned char *) AcquireQuantumMemory(8*row_size,sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
sun_info.maplength=ReadBlobMSBLong(image);
if ((sun_info.type != RT_STANDARD) && (sun_info.type != RT_ENCODED) &&
(sun_info.type != RT_FORMAT_RGB))
- ThrowReaderException(CoderError,"ImproperImageHeader");
+ ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if ((sun_info.maptype == RMT_NONE) && (sun_info.maplength != 0))
- ThrowReaderException(CoderError,"ImproperImageHeader");
+ ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if ((sun_info.depth == 0) || (sun_info.depth > 32))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
if ((sun_info.maptype != RMT_NONE) && (sun_info.maptype != RMT_EQUAL_RGB) &&
static char *NextXPMLine(char *p)
{
- assert(p != (char*)NULL);
+ assert(p != (char *)NULL);
p=strchr(p,'\n');
if (p != (char *) NULL)
p++;
}
return((char *) NULL);
}
- else
+ for (p=color+1; *p != '\0'; p++)
+ {
+ if (*p == '\n')
+ break;
+ if (isspace((int) ((unsigned char) (*(p-1)))) == 0)
+ continue;
+ if (isspace((int) ((unsigned char) (*p))) != 0)
+ continue;
+ for (i=0; i < NumberTargets; i++)
{
- for (p=color+1; *p != '\0'; p++)
- {
- if (*p == '\n')
- break;
- if (isspace((int) ((unsigned char) (*(p-1)))) == 0)
- continue;
- if (isspace((int) ((unsigned char) (*p))) != 0)
- continue;
- for (i=0; i < NumberTargets; i++)
- {
- if (*p == *targets[i] && *(p+1) == *(targets[i]+1))
- return(p);
- }
- }
- return(p);
+ if ((*p == *targets[i]) && (*(p+1) == *(targets[i]+1)))
+ return(p);
}
+ }
+ return(p);
}
static Image *ReadXPMImage(const ImageInfo *image_info,ExceptionInfo *exception)
*/
image->depth=1;
next=NextXPMLine(xpm_buffer);
- for (j=0; (j < (ssize_t) image->colors) && (next != (char*) NULL); j++)
+ for (j=0; (j < (ssize_t) image->colors) && (next != (char *) NULL); j++)
{
p=next;
next=NextXPMLine(p);