diff --git a/coders/jp2.c b/coders/jp2.c
index df08503..2835152 100644
--- a/coders/jp2.c
+++ b/coders/jp2.c
@@ -617,8 +617,9 @@
           if (image->debug != MagickFalse)
             (void) LogMagickEvent(CoderEvent,GetMagickModule(),
               "Profile: ICC, %.20g bytes",(double) blob->len_);
-          profile=AcquireStringInfo(blob->len_);
-          SetStringInfoDatum(profile,blob->buf_);
+          profile=BlobToStringInfo(blob->buf_,blob->len_);
+          if (profile == (StringInfo *) NULL)
+            ThrowReaderException(CorruptImageError,"MemoryAllocationFailed");
           icc_profile=(StringInfo *) GetImageProfile(image,"icc");
           if (icc_profile == (StringInfo *) NULL)
             (void) SetImageProfile(image,"icc",profile);