Blob Blame History Raw
From 112051a709f83f13ca2b9ab63007d4a41b0a9beb Mon Sep 17 00:00:00 2001
From: Dirk Lemstra <dirk@lemstra.org>
Date: Sun, 22 Nov 2020 18:11:37 +0100
Subject: [PATCH] Moved swapping to the correct position.

---
 coders/tiff.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/coders/tiff.c b/coders/tiff.c
index dba08138c8..fff2e79d4c 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -640,12 +640,13 @@ static MagickBooleanType TIFFGetProfiles(TIFF *tiff,Image *image)
     {
       const TIFFField
         *field;
-
-      if (TIFFIsByteSwapped(tiff) != 0)
-        TIFFSwabArrayOfLong((uint32 *) profile,(size_t) length);
       field=TIFFFieldWithTag(tiff,TIFFTAG_RICHTIFFIPTC);
       if (TIFFFieldDataType(field) == TIFF_LONG)
-        status=ReadProfile(image,"iptc",profile,4L*length);
+        {
+          if (TIFFIsByteSwapped(tiff) != 0)
+            TIFFSwabArrayOfLong((uint32 *) profile,(size_t) length);
+            status=ReadProfile(image,"iptc",profile,4L*length);
+        }
       else
         status=ReadProfile(image,"iptc",profile,length);
     }