From: dirk Date: Sat, 1 Mar 2014 17:38:22 +0000 (+0000) Subject: Fixed updating exif profile. X-Git-Tag: 7.0.1-0~2627 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c5587779bca418e558f33c9720505bc60a454f1;p=imagemagick Fixed updating exif profile. --- diff --git a/MagickCore/profile.c b/MagickCore/profile.c index dedaa8c44..5719d6313 100644 --- a/MagickCore/profile.c +++ b/MagickCore/profile.c @@ -1525,25 +1525,31 @@ MagickBooleanType SyncExifProfile(Image *image,StringInfo *profile) */ length=GetStringInfoLength(profile); exif=GetStringInfoDatum(profile); - while (length != 0) - { - if (ReadProfileByte(&exif,&length) != 0x45) - continue; - if (ReadProfileByte(&exif,&length) != 0x78) - continue; - if (ReadProfileByte(&exif,&length) != 0x69) - continue; - if (ReadProfileByte(&exif,&length) != 0x66) - continue; - if (ReadProfileByte(&exif,&length) != 0x00) - continue; - if (ReadProfileByte(&exif,&length) != 0x00) - continue; - break; - } if (length < 16) return(MagickFalse); id=(ssize_t) ReadProfileShort(LSBEndian,exif); + if ((id != 0x4949) && (id != 0x4D4D)) + { + while (length != 0) + { + if (ReadProfileByte(&exif,&length) != 0x45) + continue; + if (ReadProfileByte(&exif,&length) != 0x78) + continue; + if (ReadProfileByte(&exif,&length) != 0x69) + continue; + if (ReadProfileByte(&exif,&length) != 0x66) + continue; + if (ReadProfileByte(&exif,&length) != 0x00) + continue; + if (ReadProfileByte(&exif,&length) != 0x00) + continue; + break; + } + if (length < 16) + return(MagickFalse); + id=(ssize_t) ReadProfileShort(LSBEndian,exif); + } endian=LSBEndian; if (id == 0x4949) endian=LSBEndian;