Skip to content

Commit 216d117

Browse files
author
Cristy
committed
XBM coder leaves the hex image data uninitialized if hex value of the pixel is negative
1 parent 31dd8a9 commit 216d117

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: coders/xbm.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,10 @@ static Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception)
351351
{
352352
c=XBMInteger(image,hex_digits);
353353
if (c < 0)
354-
break;
354+
{
355+
data=(unsigned char *) RelinquishMagickMemory(data);
356+
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
357+
}
355358
*p++=(unsigned char) c;
356359
if ((padding == 0) || (((i+2) % bytes_per_line) != 0))
357360
*p++=(unsigned char) (c >> 8);
@@ -361,7 +364,10 @@ static Image *ReadXBMImage(const ImageInfo *image_info,ExceptionInfo *exception)
361364
{
362365
c=XBMInteger(image,hex_digits);
363366
if (c < 0)
364-
break;
367+
{
368+
data=(unsigned char *) RelinquishMagickMemory(data);
369+
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
370+
}
365371
*p++=(unsigned char) c;
366372
}
367373
if (EOFBlob(image) != MagickFalse)

0 commit comments

Comments
 (0)