]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 17 Aug 2011 01:23:06 +0000 (01:23 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 17 Aug 2011 01:23:06 +0000 (01:23 +0000)
coders/jpeg.c

index d6ad30ad72eabdf3963fcaa1021c34895bd3d5eb..f8782da7ef3f12bb7417331008bbe87c72be15c7 100644 (file)
@@ -617,7 +617,7 @@ static boolean ReadProfile(j_decompress_ptr jpeg_info)
     ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
       image->filename);
   p=GetStringInfoDatum(profile);
-  for (i=(ssize_t) GetStringInfoLength(profile)-1; i >= 0; i--)
+  for (i=0; i < (ssize_t) GetStringInfoLength(profile); i++)
     *p++=(unsigned char) GetCharacter(jpeg_info);
   if (marker == 1)
     {
@@ -646,7 +646,15 @@ static boolean ReadProfile(j_decompress_ptr jpeg_info)
     }
   previous_profile=GetImageProfile(image,name);
   if (previous_profile != (const StringInfo *) NULL)
-    ConcatenateStringInfo(profile,previous_profile);
+    {
+      SetStringInfoLength(profile,GetStringInfoLength(profile)+
+        GetStringInfoLength(previous_profile));
+      (void) memcpy(GetStringInfoDatum(profile),GetStringInfoDatum(profile)+
+        GetStringInfoLength(previous_profile),GetStringInfoLength(profile));
+      (void) memcpy(GetStringInfoDatum(profile),
+        GetStringInfoDatum(previous_profile),
+        GetStringInfoLength(previous_profile));
+    }
   status=SetImageProfile(image,name,profile);
   profile=DestroyStringInfo(profile);
   if (status == MagickFalse)