Skip to content

Commit

Permalink
https://github.com/ImageMagick/ImageMagick6/issues/40
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Apr 8, 2019
1 parent f135add commit 908e959
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions coders/wmf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2733,7 +2733,7 @@ static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception)
}

/* Obtain (or guess) metafile units */
if ((API)->File->placeable)
if ((API)->File->placeable && (API)->File->pmh->Inch)
units_per_inch=(API)->File->pmh->Inch;
else if ( (wmf_width*wmf_height) < 1024*1024)
units_per_inch=POINTS_PER_INCH; /* MM_TEXT */
Expand All @@ -2758,7 +2758,12 @@ static Image *ReadWMFImage(const ImageInfo *image_info,ExceptionInfo *exception)

bounding_width = bbox.BR.x - bbox.TL.x;
bounding_height = bbox.BR.y - bbox.TL.y;

if ((bounding_width == 0) || (bounding_height == 0))
{
ipa_device_close(API);
(void) wmf_api_destroy(API);
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
}
ddata->scale_x = image_width/bounding_width;
ddata->translate_x = 0-bbox.TL.x;
ddata->rotate = 0;
Expand Down

0 comments on commit 908e959

Please sign in to comment.