Skip to content

Commit

Permalink
prevent undefined-behavior issue reported by Hardik
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Apr 3, 2021
1 parent 7aab092 commit 798838f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions magick/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1967,18 +1967,18 @@ static MagickBooleanType Sync8BimProfile(Image *image,StringInfo *profile)
if ((id == 0x3ED) && (count == 16))
{
if (image->units == PixelsPerCentimeterResolution)
WriteProfileLong(MSBEndian,(unsigned int) (image->x_resolution*2.54*
65536.0),p);
WriteProfileLong(MSBEndian,(unsigned int) CastDoubleToLong(
image->x_resolution*2.54*65536.0),p);
else
WriteProfileLong(MSBEndian,(unsigned int) (image->x_resolution*
65536.0),p);
WriteProfileLong(MSBEndian,(unsigned int) CastDoubleToLong(
image->x_resolution*65536.0),p);
WriteProfileShort(MSBEndian,(unsigned short) image->units,p+4);
if (image->units == PixelsPerCentimeterResolution)
WriteProfileLong(MSBEndian,(unsigned int) (image->y_resolution*2.54*
65536.0),p+8);
WriteProfileLong(MSBEndian,(unsigned int) CastDoubleToLong(
image->y_resolution*2.54*65536.0),p+8);
else
WriteProfileLong(MSBEndian,(unsigned int) (image->y_resolution*
65536.0),p+8);
WriteProfileLong(MSBEndian,(unsigned int) CastDoubleToLong(
image->y_resolution*65536.0),p+8);
WriteProfileShort(MSBEndian,(unsigned short) image->units,p+12);
}
p+=count;
Expand Down

0 comments on commit 798838f

Please sign in to comment.