From 08f255a88c9f3c8271f0eeafb955b6a318fb4ef5 Mon Sep 17 00:00:00 2001 From: cristy Date: Wed, 17 Aug 2011 01:23:06 +0000 Subject: [PATCH] --- coders/jpeg.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/coders/jpeg.c b/coders/jpeg.c index d6ad30ad7..f8782da7e 100644 --- a/coders/jpeg.c +++ b/coders/jpeg.c @@ -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) -- 2.40.0