Skip to content
Permalink
Browse files Browse the repository at this point in the history
Added check to prevent image being 0x0 (reported in #489).
  • Loading branch information
dlemstra committed May 15, 2017
1 parent e8fc3f1 commit 0c5b1e4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions coders/dds.c
Expand Up @@ -1677,16 +1677,15 @@ static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)
/*
Initialize image structure.
*/
if (ReadDDSInfo(image, &dds_info) != MagickTrue) {
if (ReadDDSInfo(image, &dds_info) != MagickTrue)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
}


if (dds_info.ddscaps2 & DDSCAPS2_CUBEMAP)
cubemap = MagickTrue;

if (dds_info.ddscaps2 & DDSCAPS2_VOLUME && dds_info.depth > 0)
volume = MagickTrue;

(void) SeekBlob(image, 128, SEEK_SET);

/*
Expand Down Expand Up @@ -1775,7 +1774,10 @@ static Image *ReadDDSImage(const ImageInfo *image_info,ExceptionInfo *exception)

if (volume)
num_images = dds_info.depth;


if (num_images < 1)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");

for (n = 0; n < num_images; n++)
{
if (n != 0)
Expand Down

0 comments on commit 0c5b1e4

Please sign in to comment.