% July 2001 %
% %
% %
-% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
-% http://www.imagemagick.org/script/license.php %
+% https://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
/*
Include declarations.
*/
-#include "magick/studio.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/image.h"
-#include "magick/image-private.h"
-#include "magick/list.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/module.h"
-#include "magick/profile.h"
-#include "magick/splay-tree.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/string-private.h"
-#include "magick/token.h"
-#include "magick/utility.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/channel.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/list.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/module.h"
+#include "MagickCore/profile.h"
+#include "MagickCore/splay-tree.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/string-private.h"
+#include "MagickCore/token.h"
+#include "MagickCore/utility.h"
\f
/*
Forward declarations.
*/
static MagickBooleanType
- WriteMETAImage(const ImageInfo *,Image *);
+ WriteMETAImage(const ImageInfo *,Image *,ExceptionInfo *);
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% o exception: return any errors or warnings in this structure.
%
*/
-#define BUFFER_SZ 4096
typedef struct _html_code
{
- short
+ const short int
len;
+
const char
*code,
val;
} html_code;
-static html_code html_codes[] = {
+static const html_code html_codes[] = {
#ifdef HANDLE_GT_LT
{ 4,"<",'<' },
{ 4,">",'>' },
return(toupper((int) *p)-toupper((int) *q));
}
-static int convertHTMLcodes(char *s, int len)
+static size_t convertHTMLcodes(char *s)
{
- if (len <=0 || s==(char*)NULL || *s=='\0')
- return 0;
+ int
+ value;
- if (s[1] == '#')
- {
- int val, o;
+ register size_t
+ i;
+
+ size_t
+ length;
- if (sscanf(s,"&#%d;",&val) == 1)
+ length=0;
+ for (i=0; (i < 7U) && (s[i] != '\0'); i++)
+ if (s[i] == ';')
{
- o = 3;
- while (s[o] != ';')
- {
- o++;
- if (o > 5)
- break;
- }
- if (o < 6)
- (void) strcpy(s+1,s+1+o);
- *s = val;
- return o;
+ length=i+1;
+ break;
}
- }
- else
+ if ((length == 0) || (s == (char *) NULL) || (*s == '\0'))
+ return(0);
+ if ((length > 3) && (s[1] == '#') && (sscanf(s,"&#%d;",&value) == 1))
{
- int
- i,
- codes = (int) (sizeof(html_codes) / sizeof(html_code));
+ size_t
+ o;
- for (i=0; i < codes; i++)
+ o=3;
+ while (s[o] != ';')
{
- if (html_codes[i].len <= len)
- if (stringnicmp(s,html_codes[i].code,(size_t) html_codes[i].len) == 0)
- {
- (void) strcpy(s+1,s+html_codes[i].len);
- *s = html_codes[i].val;
- return html_codes[i].len-1;
- }
+ o++;
+ if (o > 5)
+ break;
}
+ if (o < 6)
+ (void) memmove(s+1,s+1+o,strlen(s+1+o)+1);
+ *s=value;
+ return(o);
}
- return 0;
+ {
+ int
+ codes;
+
+ codes=sizeof(html_codes)/sizeof(html_code);
+ for (i=0; i < codes; i++)
+ {
+ if (html_codes[i].len <= length)
+ if (stringnicmp(s,html_codes[i].code,(size_t) (html_codes[i].len)) == 0)
+ {
+ (void) memmove(s+1,s+html_codes[i].len,strlen(s+html_codes[i].len)+
+ 1);
+ *s=html_codes[i].val;
+ return(html_codes[i].len-1);
+ }
+ }
+ }
+ return(0);
}
static char *super_fgets(char **b, int *blen, Image *file)
return((char *) p);
}
-#define BUFFER_SZ 4096
#define IPTC_ID 1028
#define THUMBNAIL_ID 1033
recnum;
int
- inputlen = BUFFER_SZ;
-
- ssize_t
- savedolen = 0L,
- outputlen = 0L;
+ inputlen = MagickPathExtent;
MagickOffsetType
savedpos,
currentpos;
+ ssize_t
+ savedolen = 0L,
+ outputlen = 0L;
+
TokenInfo
*token_info;
dataset = 0;
recnum = 0;
line = (char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*line));
- name = token = (char *)NULL;
+ if (line == (char *) NULL)
+ return(-1);
+ newstr = name = token = (char *) NULL;
savedpos = 0;
token_info=AcquireTokenInfo();
while (super_fgets(&line,&inputlen,ifile)!=NULL)
next=0;
token=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*token));
+ if (token == (char *) NULL)
+ break;
newstr=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*newstr));
+ if (newstr == (char *) NULL)
+ break;
while (Tokenizer(token_info,0,token,(size_t) inputlen,line,"","=","\"",0,
&brkused,&next,"ed)==0)
{
recnum = (unsigned int) StringToUnsignedLong(newstr);
break;
case 2:
- name=(char *) AcquireQuantumMemory(strlen(newstr)+MaxTextExtent,
+ name=(char *) AcquireQuantumMemory(strlen(newstr)+MagickPathExtent,
sizeof(*name));
if (name)
(void) strcpy(name,newstr);
{
if (brkused && next > 0)
{
+ size_t
+ codes_length;
+
char
*s = &token[next-1];
- len -= (ssize_t) convertHTMLcodes(s,(int) strlen(s));
+ codes_length=convertHTMLcodes(s);
+ if ((ssize_t) codes_length > len)
+ len=0;
+ else
+ len-=codes_length;
}
}
ssize_t diff = outputlen - savedolen;
currentpos = TellBlob(ofile);
+ if (currentpos < 0)
+ {
+ line=DestroyString(line);
+ return(-1);
+ }
offset=SeekBlob(ofile,savedpos,SEEK_SET);
if (offset < 0)
- return(-1);
+ {
+ line=DestroyString(line);
+ return(-1);
+ }
(void) WriteBlobMSBLong(ofile,(unsigned int) diff);
offset=SeekBlob(ofile,currentpos,SEEK_SET);
if (offset < 0)
- return(-1);
+ {
+ line=DestroyString(line);
+ return(-1);
+ }
savedolen = 0L;
}
if (outputlen & 1)
next=0;
outputlen += len;
- while (len--)
+ while (len-- > 0)
(void) WriteBlobByte(ofile,(unsigned char) token[next++]);
if (outputlen & 1)
{
/* patch in a fake length for now and fix it later */
savedpos = TellBlob(ofile);
+ if (savedpos < 0)
+ return(-1);
(void) WriteBlobMSBLong(ofile,0xFFFFFFFFU);
outputlen += 4;
savedolen = outputlen;
outputlen += 5;
next=0;
outputlen += len;
- while (len--)
+ while (len-- > 0)
(void) WriteBlobByte(ofile,(unsigned char) token[next++]);
}
}
}
state++;
}
- token=DestroyString(token);
- newstr=DestroyString(newstr);
+ if (token != (char *) NULL)
+ token=DestroyString(token);
+ if (newstr != (char *) NULL)
+ newstr=DestroyString(newstr);
if (name != (char *) NULL)
name=DestroyString(name);
}
token_info=DestroyTokenInfo(token_info);
+ if (token != (char *) NULL)
+ token=DestroyString(token);
+ if (newstr != (char *) NULL)
+ newstr=DestroyString(newstr);
+ if (name != (char *) NULL)
+ name=DestroyString(name);
line=DestroyString(line);
if (savedolen > 0)
{
ssize_t diff = outputlen - savedolen;
currentpos = TellBlob(ofile);
+ if (currentpos < 0)
+ return(-1);
offset=SeekBlob(ofile,savedpos,SEEK_SET);
if (offset < 0)
return(-1);
p=(unsigned char *) (*b);
for (q=p; ; q++)
{
- c=(int) ReadBlobLSBShort(file);
+ c=ReadBlobLSBSignedShort(file);
if ((c == -1) || (c == '\n'))
break;
if (EOFBlob(file))
recnum;
int
- inputlen = BUFFER_SZ;
+ inputlen = MagickPathExtent;
ssize_t
savedolen = 0L,
dataset = 0;
recnum = 0;
line=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*line));
- name = token = (char *)NULL;
+ if (line == (char *) NULL)
+ return(-1);
+ newstr = name = token = (char *) NULL;
savedpos = 0;
token_info=AcquireTokenInfo();
while (super_fgets_w(&line,&inputlen,ifile) != NULL)
next=0;
token=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*token));
+ if (token == (char *) NULL)
+ break;
newstr=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*newstr));
+ if (newstr == (char *) NULL)
+ break;
while (Tokenizer(token_info,0,token,(size_t) inputlen,line,"","=","\"",0,
&brkused,&next,"ed)==0)
{
recnum=(unsigned int) StringToUnsignedLong(newstr);
break;
case 2:
- name=(char *) AcquireQuantumMemory(strlen(newstr)+MaxTextExtent,
+ name=(char *) AcquireQuantumMemory(strlen(newstr)+MagickPathExtent,
sizeof(*name));
if (name)
- (void) CopyMagickString(name,newstr,strlen(newstr)+MaxTextExtent);
+ (void) CopyMagickString(name,newstr,strlen(newstr)+MagickPathExtent);
break;
}
state++;
{
if (brkused && next > 0)
{
+ size_t
+ codes_length;
+
char
*s = &token[next-1];
- len -= (ssize_t) convertHTMLcodes(s,(int) strlen(s));
+ codes_length=convertHTMLcodes(s);
+ if ((ssize_t) codes_length > len)
+ len=0;
+ else
+ len-=codes_length;
}
}
ssize_t diff = outputlen - savedolen;
currentpos = TellBlob(ofile);
+ if (currentpos < 0)
+ return(-1);
offset=SeekBlob(ofile,savedpos,SEEK_SET);
if (offset < 0)
return(-1);
{
/* patch in a fake length for now and fix it later */
savedpos = TellBlob(ofile);
+ if (savedpos < 0)
+ return(-1);
(void) WriteBlobMSBLong(ofile,0xFFFFFFFFU);
outputlen += 4;
savedolen = outputlen;
}
state++;
}
+ if (token != (char *) NULL)
+ token=DestroyString(token);
+ if (newstr != (char *) NULL)
+ newstr=DestroyString(newstr);
+ if (name != (char *) NULL)
+ name=DestroyString(name);
+ }
+ token_info=DestroyTokenInfo(token_info);
+ if (token != (char *) NULL)
token=DestroyString(token);
+ if (newstr != (char *) NULL)
newstr=DestroyString(newstr);
+ if (name != (char *) NULL)
name=DestroyString(name);
- }
- token_info=DestroyTokenInfo(token_info);
line=DestroyString(line);
if (savedolen > 0)
{
ssize_t diff = outputlen - savedolen;
currentpos = TellBlob(ofile);
+ if (currentpos < 0)
+ return(-1);
offset=SeekBlob(ofile,savedpos,SEEK_SET);
if (offset < 0)
return(-1);
return(-1);
savedolen = 0L;
}
- return outputlen;
+ return(outputlen);
}
/* some defines for the different JPEG block types */
if ((c2 = jpeg_transfer_1(ifile, ofile)) == EOF)
return M_EOI;
- length = (((unsigned char) c1) << 8) + ((unsigned char) c2);
+ length = (((unsigned int) c1) << 8) + ((unsigned int) c2);
length -= 2;
while (length--)
if ((c1 = ReadBlobByte(ifile)) == EOF) return M_EOI;
if ((c2 = ReadBlobByte(ifile)) == EOF) return M_EOI;
- length = (((unsigned char) c1) << 8) + ((unsigned char) c2);
+ length = (((unsigned int) c1) << 8) + ((unsigned int) c2);
length -= 2;
while (length--)
}
#endif
-static char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0";
-
/* Embed binary IPTC data into a JPEG image. */
static int jpeg_embed(Image *ifile, Image *ofile, Image *iptc)
{
/* APP0 is in each and every JPEG, so when we hit APP0 we insert our new APP13! */
jpeg_skip_variable(ifile, ofile);
- if (iptc != (Image *)NULL)
+ if (iptc != (Image *) NULL)
{
+ char
+ psheader[] = "\xFF\xED\0\0Photoshop 3.0\0" "8BIM\x04\x04\0\0\0\0";
+
len=(unsigned int) GetBlobSize(iptc);
if (len & 1)
len++; /* make the length even */
}
#endif
+static inline void CopyBlob(Image *source,Image *destination)
+{
+ ssize_t
+ i;
+
+ unsigned char
+ *buffer;
+
+ ssize_t
+ count,
+ length;
+
+ buffer=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent,
+ sizeof(*buffer));
+ if (buffer != (unsigned char *) NULL)
+ {
+ i=0;
+ while ((length=ReadBlob(source,MagickMaxBufferExtent,buffer)) != 0)
+ {
+ count=0;
+ for (i=0; i < (ssize_t) length; i+=count)
+ {
+ count=WriteBlob(destination,(size_t) (length-i),buffer+i);
+ if (count <= 0)
+ break;
+ }
+ if (i < (ssize_t) length)
+ break;
+ }
+ buffer=(unsigned char *) RelinquishMagickMemory(buffer);
+ }
+}
+
static Image *ReadMETAImage(const ImageInfo *image_info,
ExceptionInfo *exception)
{
*buff,
*image;
- int
- c;
-
MagickBooleanType
status;
Open file containing binary metadata
*/
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
- assert(exception->signature == MagickSignature);
- image=AcquireImage(image_info);
+ assert(exception->signature == MagickCoreSignature);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
}
image->columns=1;
image->rows=1;
- if (SetImageBackgroundColor(image) == MagickFalse)
+ if (SetImageBackgroundColor(image,exception) == MagickFalse)
{
- InheritException(exception,&image->exception);
image=DestroyImageList(image);
return((Image *) NULL);
}
/*
Read 8BIM binary metadata.
*/
- buff=AcquireImage((ImageInfo *) NULL);
+ buff=AcquireImage((ImageInfo *) NULL,exception);
if (buff == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=(unsigned char *) AcquireQuantumMemory(length,sizeof(unsigned char));
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
+ (void) memset(blob,0,length);
AttachBlob(buff->blob,blob,length);
if (LocaleCompare(image_info->magick,"8BIMTEXT") == 0)
{
length=(size_t) parse8BIM(image, buff);
+ if (length == 0)
+ {
+ blob=DetachBlob(buff->blob);
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
+ buff=DestroyImage(buff);
+ ThrowReaderException(CorruptImageError,"CorruptImage");
+ }
if (length & 1)
(void) WriteBlobByte(buff,0x0);
}
else if (LocaleCompare(image_info->magick,"8BIMWTEXT") == 0)
{
length=(size_t) parse8BIMW(image, buff);
+ if (length == 0)
+ {
+ blob=DetachBlob(buff->blob);
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
+ buff=DestroyImage(buff);
+ ThrowReaderException(CorruptImageError,"CorruptImage");
+ }
if (length & 1)
(void) WriteBlobByte(buff,0x0);
}
else
+ CopyBlob(image,buff);
+ profile=BlobToStringInfo(GetBlobStreamData(buff),(size_t)
+ GetBlobSize(buff));
+ if (profile == (StringInfo *) NULL)
{
- for ( ; ; )
- {
- c=ReadBlobByte(image);
- if (c == EOF)
- break;
- (void) WriteBlobByte(buff,(unsigned char) c);
- }
+ blob=DetachBlob(buff->blob);
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
+ buff=DestroyImage(buff);
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
- profile=AcquireStringInfo((size_t) GetBlobSize(buff));
- SetStringInfoDatum(profile,GetBlobStreamData(buff));
- status=SetImageProfile(image,"8bim",profile);
+ status=SetImageProfile(image,"8bim",profile,exception);
profile=DestroyStringInfo(profile);
- if (status == MagickFalse)
- ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
+ if (status == MagickFalse)
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
if (LocaleNCompare(image_info->magick,"APP1",4) == 0)
{
char
- name[MaxTextExtent];
+ name[MagickPathExtent];
- (void) FormatMagickString(name,MaxTextExtent,"APP%d",1);
- buff=AcquireImage((ImageInfo *) NULL);
+ (void) FormatLocaleString(name,MagickPathExtent,"APP%d",1);
+ buff=AcquireImage((ImageInfo *) NULL,exception);
if (buff == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=(unsigned char *) AcquireQuantumMemory(length,sizeof(unsigned char));
if (image_info->profile == (void *) NULL)
{
blob=DetachBlob(buff->blob);
- blob=RelinquishMagickMemory(blob);
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
ThrowReaderException(CoderError,"NoIPTCProfileAvailable");
}
profile=CloneStringInfo((StringInfo *) image_info->profile);
- iptc=AcquireImage((ImageInfo *) NULL);
+ iptc=AcquireImage((ImageInfo *) NULL,exception);
if (iptc == (Image *) NULL)
{
blob=DetachBlob(buff->blob);
- blob=RelinquishMagickMemory(blob);
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
GetStringInfoLength(profile));
result=jpeg_embed(image,buff,iptc);
blob=DetachBlob(iptc->blob);
- blob=RelinquishMagickMemory(blob);
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
iptc=DestroyImage(iptc);
if (result == 0)
{
- blob=DetachBlob(buff->blob);
- blob=RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
ThrowReaderException(CoderError,"JPEGEmbeddingFailed");
}
}
else
+ CopyBlob(image,buff);
+ profile=BlobToStringInfo(GetBlobStreamData(buff),(size_t)
+ GetBlobSize(buff));
+ if (profile == (StringInfo *) NULL)
{
-#ifdef SLOW_METHOD
- for ( ; ; )
- {
- /* Really - really slow - FIX ME PLEASE!!!! */
- c=ReadBlobByte(image);
- if (c == EOF)
- break;
- (void) WriteBlobByte(buff,c);
- }
-#else
- ssize_t
- i;
-
- unsigned char
- *buffer;
-
- ssize_t
- count,
- length;
-
- buffer=(unsigned char *) AcquireQuantumMemory(MagickMaxBufferExtent,
- sizeof(*buffer));
- if (buffer != (unsigned char *) NULL)
- {
- i=0;
- while ((length=ReadBlob(image,MagickMaxBufferExtent,buffer)) != 0)
- {
- count=0;
- for (i=0; i < (ssize_t) length; i+=count)
- {
- count=WriteBlob(buff,(size_t) (length-i),buffer+i);
- if (count <= 0)
- break;
- }
- if (i < (ssize_t) length)
- break;
- }
- buffer=(unsigned char *) RelinquishMagickMemory(buffer);
- }
-#endif
+ blob=DetachBlob(buff->blob);
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
+ buff=DestroyImage(buff);
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
- profile=AcquireStringInfo((size_t) GetBlobSize(buff));
- SetStringInfoDatum(profile,GetBlobStreamData(buff));
- status=SetImageProfile(image,name,profile);
+ status=SetImageProfile(image,name,profile,exception);
profile=DestroyStringInfo(profile);
- if (status == MagickFalse)
- ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=DetachBlob(buff->blob);
- blob=RelinquishMagickMemory(blob);
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
buff=DestroyImage(buff);
+ if (status == MagickFalse)
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
if ((LocaleCompare(image_info->magick,"ICC") == 0) ||
(LocaleCompare(image_info->magick,"ICM") == 0))
{
- buff=AcquireImage((ImageInfo *) NULL);
+ buff=AcquireImage((ImageInfo *) NULL,exception);
if (buff == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=(unsigned char *) AcquireQuantumMemory(length,sizeof(unsigned char));
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
AttachBlob(buff->blob,blob,length);
- for ( ; ; )
- {
- c=ReadBlobByte(image);
- if (c == EOF)
- break;
- (void) WriteBlobByte(buff,(unsigned char) c);
- }
- profile=AcquireStringInfo((size_t) GetBlobSize(buff));
- SetStringInfoDatum(profile,GetBlobStreamData(buff));
- (void) SetImageProfile(image,"icc",profile);
+ CopyBlob(image,buff);
+ profile=BlobToStringInfo(GetBlobStreamData(buff),(size_t)
+ GetBlobSize(buff));
+ if (profile == (StringInfo *) NULL)
+ {
+ blob=DetachBlob(buff->blob);
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
+ buff=DestroyImage(buff);
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ }
+ (void) SetImageProfile(image,"icc",profile,exception);
profile=DestroyStringInfo(profile);
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
}
if (LocaleCompare(image_info->magick,"IPTC") == 0)
{
- register unsigned char
- *p;
-
- buff=AcquireImage((ImageInfo *) NULL);
+ buff=AcquireImage((ImageInfo *) NULL,exception);
if (buff == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=(unsigned char *) AcquireQuantumMemory(length,sizeof(unsigned char));
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
AttachBlob(buff->blob,blob,length);
- /* write out the header - length field patched below */
- (void) WriteBlob(buff,11,(unsigned char *) "8BIM\04\04\0\0\0\0\01");
- (void) WriteBlobByte(buff,0xe0);
- if (LocaleCompare(image_info->magick,"IPTCTEXT") == 0)
- {
- length=(size_t) parse8BIM(image,buff);
- if (length & 1)
- (void) WriteBlobByte(buff,0x00);
- }
- else if (LocaleCompare(image_info->magick,"IPTCWTEXT") == 0)
- {
- }
- else
+ CopyBlob(image,buff);
+ profile=BlobToStringInfo(GetBlobStreamData(buff),(size_t)
+ GetBlobSize(buff));
+ if (profile == (StringInfo *) NULL)
{
- for ( ; ; )
- {
- c=ReadBlobByte(image);
- if (c == EOF)
- break;
- (void) WriteBlobByte(buff,(unsigned char) c);
- }
+ blob=DetachBlob(buff->blob);
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
+ buff=DestroyImage(buff);
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
- profile=AcquireStringInfo((size_t) GetBlobSize(buff));
- /*
- subtract off the length of the 8BIM stuff.
- */
- length=GetStringInfoLength(profile)-12;
- p=GetStringInfoDatum(profile);
- p[10]=(unsigned char) (length >> 8);
- p[11]=(unsigned char) (length & 0xff);
- SetStringInfoDatum(profile,GetBlobStreamData(buff));
- (void) SetImageProfile(image,"8bim",profile);
+ (void) SetImageProfile(image,"8bim",profile,exception);
profile=DestroyStringInfo(profile);
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
}
if (LocaleCompare(image_info->magick,"XMP") == 0)
{
- buff=AcquireImage((ImageInfo *) NULL);
+ buff=AcquireImage((ImageInfo *) NULL,exception);
if (buff == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
blob=(unsigned char *) AcquireQuantumMemory(length,sizeof(unsigned char));
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
}
AttachBlob(buff->blob,blob,length);
- for ( ; ; )
- {
- c=ReadBlobByte(image);
- if (c == EOF)
- break;
- (void) WriteBlobByte(buff,(unsigned char) c);
- }
- profile=AcquireStringInfo((size_t) GetBlobSize(buff));
- SetStringInfoDatum(profile,GetBlobStreamData(buff));
- (void) SetImageProfile(image,"xmp",profile);
+ CopyBlob(image,buff);
+ profile=BlobToStringInfo(GetBlobStreamData(buff),(size_t)
+ GetBlobSize(buff));
+ if (profile == (StringInfo *) NULL)
+ {
+ blob=DetachBlob(buff->blob);
+ blob=(unsigned char *) RelinquishMagickMemory(blob);
+ buff=DestroyImage(buff);
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+ }
+ (void) SetImageProfile(image,"xmp",profile,exception);
profile=DestroyStringInfo(profile);
blob=DetachBlob(buff->blob);
blob=(unsigned char *) RelinquishMagickMemory(blob);
MagickInfo
*entry;
- entry=SetMagickInfo("8BIM");
+ entry=AcquireMagickInfo("META","8BIM","Photoshop resource format");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("Photoshop resource format");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
-
- entry=SetMagickInfo("8BIMTEXT");
+ entry=AcquireMagickInfo("META","8BIMTEXT","Photoshop resource text format");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("Photoshop resource text format");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
-
- entry=SetMagickInfo("8BIMWTEXT");
+ entry=AcquireMagickInfo("META","8BIMWTEXT",
+ "Photoshop resource wide text format");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("Photoshop resource wide text format");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
-
- entry=SetMagickInfo("APP1");
+ entry=AcquireMagickInfo("META","APP1","Raw application information");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("Raw application information");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
-
- entry=SetMagickInfo("APP1JPEG");
+ entry=AcquireMagickInfo("META","APP1JPEG","Raw JPEG binary data");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("Raw JPEG binary data");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
-
- entry=SetMagickInfo("EXIF");
+ entry=AcquireMagickInfo("META","EXIF","Exif digital camera binary data");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("Exif digital camera binary data");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
-
- entry=SetMagickInfo("XMP");
+ entry=AcquireMagickInfo("META","XMP","Adobe XML metadata");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("Adobe XML metadata");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
-
- entry=SetMagickInfo("ICM");
+ entry=AcquireMagickInfo("META","ICM","ICC Color Profile");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("ICC Color Profile");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
-
- entry=SetMagickInfo("ICC");
+ entry=AcquireMagickInfo("META","ICC","ICC Color Profile");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("ICC Color Profile");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
-
- entry=SetMagickInfo("IPTC");
+ entry=AcquireMagickInfo("META","IPTC","IPTC Newsphoto");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("IPTC Newsphoto");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
-
- entry=SetMagickInfo("IPTCTEXT");
+ entry=AcquireMagickInfo("META","IPTCTEXT","IPTC Newsphoto text format");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("IPTC Newsphoto text format");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
-
- entry=SetMagickInfo("IPTCWTEXT");
+ entry=AcquireMagickInfo("META","IPTCWTEXT","IPTC Newsphoto text format");
entry->decoder=(DecodeImageHandler *) ReadMETAImage;
entry->encoder=(EncodeImageHandler *) WriteMETAImage;
- entry->adjoin=MagickFalse;
- entry->stealth=MagickTrue;
- entry->seekable_stream=MagickTrue;
- entry->description=ConstantString("IPTC Newsphoto text format");
- entry->module=ConstantString("META");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderStealthFlag;
+ entry->flags|=CoderDecoderSeekableStreamFlag;
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
% The format of the WriteMETAImage method is:
%
% MagickBooleanType WriteMETAImage(const ImageInfo *image_info,
-% Image *image)
+% Image *image,ExceptionInfo *exception)
%
% Compression code contributed by Kyle Shorter.
%
%
% o image: A pointer to a Image structure.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
static size_t GetIPTCStream(unsigned char **info,size_t length)
extent,
info_length;
- unsigned char
- buffer[4] = { '\0', '\0', '\0', '\0' };
-
unsigned int
marker;
info_length++;
if ((c & 0x80) != 0)
{
+ /*
+ Long format.
+ */
+ tag_length=0;
for (i=0; i < 4; i++)
{
- buffer[i]=(*p++);
+ tag_length<<=8;
+ tag_length|=(*p++);
length--;
if (length == 0)
break;
info_length++;
}
- tag_length=(((size_t) buffer[0]) << 24) |
- (((size_t) buffer[1]) << 16) |
- (((size_t) buffer[2]) << 8) | (((size_t) buffer[3]));
}
else
{
- tag_length=(size_t) (c << 8);
+ /*
+ Short format.
+ */
+ tag_length=((long) c) << 8;
c=(*p++);
length--;
if (length == 0)
break;
info_length++;
- tag_length|=c;
+ tag_length|=(long) c;
}
if (tag_length > (length+1))
break;
static void formatString(Image *ofile, const char *s, int len)
{
char
- temp[MaxTextExtent];
+ temp[MagickPathExtent];
(void) WriteBlobByte(ofile,'"');
for (; len > 0; len--, s++) {
(void) WriteBlobByte(ofile,(unsigned char) *s);
else
{
- (void) FormatMagickString(temp,MaxTextExtent,"&#%d;", c & 255);
+ (void) FormatLocaleString(temp,MagickPathExtent,"&#%d;", c & 255);
(void) WriteBlobString(ofile,temp);
}
break;
typedef struct _tag_spec
{
- short
+ const short
id;
const char
{ 80, "Byline" },
{ 85, "Byline Title" },
{ 90, "City" },
+ { 92, "Sub-Location" },
{ 95, "Province State" },
{ 100, "Country Code" },
{ 101, "Country" },
static int formatIPTC(Image *ifile, Image *ofile)
{
char
- temp[MaxTextExtent];
+ temp[MagickPathExtent];
unsigned int
foundiptc,
else
{
if (foundiptc)
- return -1;
+ return(-1);
else
- continue;
+ {
+ c=0;
+ continue;
+ }
}
/* we found the 0x1c tag and now grab the dataset and record number tags */
c = ReadBlobByte(ifile);
- if (c == EOF) return -1;
+ if (c == EOF)
+ return(-1);
dataset = (unsigned char) c;
c = ReadBlobByte(ifile);
- if (c == EOF) return -1;
+ if (c == EOF)
+ return(-1);
recnum = (unsigned char) c;
/* try to match this record to one of the ones in our named table */
for (i=0; i< tagcount; i++)
We decode the length of the block that follows - ssize_t or short fmt.
*/
c=ReadBlobByte(ifile);
- if (c == EOF) return -1;
+ if (c == EOF)
+ return(-1);
if (c & (unsigned char) 0x80)
- return 0;
+ return(0);
else
{
int
c0;
c0=ReadBlobByte(ifile);
- if (c0 == EOF) return -1;
+ if (c0 == EOF)
+ return(-1);
taglen = (c << 8) | c0;
}
- if (taglen < 0) return -1;
+ if (taglen < 0)
+ return(-1);
/* make a buffer to hold the tag datand snag it from the input stream */
- str=(unsigned char *) AcquireQuantumMemory((size_t) (taglen+MaxTextExtent),
- sizeof(*str));
+ str=(unsigned char *) AcquireQuantumMemory((size_t) (taglen+
+ MagickPathExtent),sizeof(*str));
if (str == (unsigned char *) NULL)
- {
- printf("MemoryAllocationFailed");
- return 0;
- }
+ return(0);
for (tagindx=0; tagindx<taglen; tagindx++)
{
c=ReadBlobByte(ifile);
- if (c == EOF) return -1;
+ if (c == EOF)
+ {
+ str=(unsigned char *) RelinquishMagickMemory(str);
+ return(-1);
+ }
str[tagindx] = (unsigned char) c;
}
str[taglen] = 0;
/* now finish up by formatting this binary data into ASCII equivalent */
if (strlen((char *)readable) > 0)
- (void) FormatMagickString(temp,MaxTextExtent,"%d#%d#%s=",
+ (void) FormatLocaleString(temp,MagickPathExtent,"%d#%d#%s=",
(unsigned int) dataset, (unsigned int) recnum, readable);
else
- (void) FormatMagickString(temp,MaxTextExtent,"%d#%d=",
+ (void) FormatLocaleString(temp,MagickPathExtent,"%d#%d=",
(unsigned int) dataset,(unsigned int) recnum);
(void) WriteBlobString(ofile,temp);
formatString( ofile, (char *)str, taglen );
static int formatIPTCfromBuffer(Image *ofile, char *s, ssize_t len)
{
char
- temp[MaxTextExtent];
+ temp[MagickPathExtent];
unsigned int
foundiptc,
}
if (taglen < 0)
return(-1);
+ if (taglen > 65535)
+ return(-1);
/* make a buffer to hold the tag datand snag it from the input stream */
- str=(unsigned char *) AcquireQuantumMemory((size_t) (taglen+MaxTextExtent),
- sizeof(*str));
+ str=(unsigned char *) AcquireQuantumMemory((size_t) (taglen+
+ MagickPathExtent),sizeof(*str));
if (str == (unsigned char *) NULL)
{
- printf("MemoryAllocationFailed");
+ (void) printf("MemoryAllocationFailed");
return 0;
}
for (tagindx=0; tagindx<taglen; tagindx++)
{
c = *s++; len--;
if (len < 0)
- return(-1);
+ {
+ str=(unsigned char *) RelinquishMagickMemory(str);
+ return(-1);
+ }
str[tagindx]=(unsigned char) c;
}
str[taglen]=0;
/* now finish up by formatting this binary data into ASCII equivalent */
if (strlen((char *)readable) > 0)
- (void) FormatMagickString(temp,MaxTextExtent,"%d#%d#%s=",
+ (void) FormatLocaleString(temp,MagickPathExtent,"%d#%d#%s=",
(unsigned int) dataset,(unsigned int) recnum, readable);
else
- (void) FormatMagickString(temp,MaxTextExtent,"%d#%d=",
+ (void) FormatLocaleString(temp,MagickPathExtent,"%d#%d=",
(unsigned int) dataset,(unsigned int) recnum);
(void) WriteBlobString(ofile,temp);
formatString( ofile, (char *)str, taglen );
static int format8BIM(Image *ifile, Image *ofile)
{
char
- temp[MaxTextExtent];
+ temp[MagickPathExtent];
unsigned int
foundOSType;
resCount=0;
foundOSType=0; /* found the OSType */
+ (void) foundOSType;
c=ReadBlobByte(ifile);
while (c != EOF)
{
/*
We found the OSType (8BIM) and now grab the ID, PString, and Size fields.
*/
- ID=(int) ReadBlobMSBShort(ifile);
+ ID=ReadBlobMSBSignedShort(ifile);
if (ID < 0)
return(-1);
{
return(-1);
plen = (unsigned char) c;
PString=(unsigned char *) AcquireQuantumMemory((size_t) (plen+
- MaxTextExtent),sizeof(*PString));
+ MagickPathExtent),sizeof(*PString));
if (PString == (unsigned char *) NULL)
- {
- printf("MemoryAllocationFailed");
- return 0;
- }
+ return 0;
for (i=0; i<plen; i++)
{
c=ReadBlobByte(ifile);
- if (c == EOF) return -1;
+ if (c == EOF)
+ {
+ PString=(unsigned char *) RelinquishMagickMemory(PString);
+ return -1;
+ }
PString[i] = (unsigned char) c;
}
PString[ plen ] = 0;
{
c=ReadBlobByte(ifile);
if (c == EOF)
- return(-1);
+ {
+ PString=(unsigned char *) RelinquishMagickMemory(PString);
+ return -1;
+ }
}
}
- count = (ssize_t) ReadBlobMSBLong(ifile);
- if (count < 0) return -1;
- /* make a buffer to hold the datand snag it from the input stream */
- str=(unsigned char *) AcquireQuantumMemory((size_t) count,sizeof(*str));
+ count=(ssize_t) ReadBlobMSBSignedLong(ifile);
+ if ((count < 0) || (count > GetBlobSize(ifile)))
+ {
+ PString=(unsigned char *) RelinquishMagickMemory(PString);
+ return -1;
+ }
+ /* make a buffer to hold the data and snag it from the input stream */
+ str=(unsigned char *) AcquireQuantumMemory((size_t) count+1,sizeof(*str));
if (str == (unsigned char *) NULL)
{
- printf("MemoryAllocationFailed");
+ PString=(unsigned char *) RelinquishMagickMemory(PString);
return 0;
}
for (i=0; i < (ssize_t) count; i++)
{
c=ReadBlobByte(ifile);
if (c == EOF)
- return(-1);
+ {
+ str=(unsigned char *) RelinquishMagickMemory(str);
+ PString=(unsigned char *) RelinquishMagickMemory(PString);
+ return -1;
+ }
str[i]=(unsigned char) c;
}
* ASCII equivalent
*/
if (strlen((const char *)PString) > 0)
- (void) FormatMagickString(temp,MaxTextExtent,"8BIM#%d#%s=",ID,
+ (void) FormatLocaleString(temp,MagickPathExtent,"8BIM#%d#%s=",ID,
PString);
else
- (void) FormatMagickString(temp,MaxTextExtent,"8BIM#%d=",ID);
+ (void) FormatLocaleString(temp,MagickPathExtent,"8BIM#%d=",ID);
(void) WriteBlobString(ofile,temp);
if (ID == IPTC_ID)
{
}
static MagickBooleanType WriteMETAImage(const ImageInfo *image_info,
- Image *image)
+ Image *image,ExceptionInfo *exception)
{
const StringInfo
*profile;
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
+ assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
length=0;
profile=GetImageProfile(image,"8bim");
if (profile == (StringInfo *) NULL)
ThrowWriterException(CoderError,"No8BIMDataIsAvailable");
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickCoreSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
(void) WriteBlob(image,GetStringInfoLength(profile),
unsigned char
*info;
- profile=GetImageProfile(image,"8bim");
+ profile=GetImageProfile(image,"iptc");
+ if (profile == (StringInfo *) NULL)
+ profile=GetImageProfile(image,"8bim");
if (profile == (StringInfo *) NULL)
ThrowWriterException(CoderError,"No8BIMDataIsAvailable");
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickCoreSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
info=GetStringInfoDatum(profile);
length=GetStringInfoLength(profile);
length=GetIPTCStream(&info,length);
profile=GetImageProfile(image,"8bim");
if (profile == (StringInfo *) NULL)
ThrowWriterException(CoderError,"No8BIMDataIsAvailable");
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickCoreSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
- buff=AcquireImage((ImageInfo *) NULL);
+ buff=AcquireImage((ImageInfo *) NULL,exception);
if (buff == (Image *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
AttachBlob(buff->blob,GetStringInfoDatum(profile),
length=GetIPTCStream(&info,length);
if (length == 0)
ThrowWriterException(CoderError,"NoIPTCProfileAvailable");
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickCoreSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
- buff=AcquireImage((ImageInfo *) NULL);
+ buff=AcquireImage((ImageInfo *) NULL,exception);
if (buff == (Image *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
AttachBlob(buff->blob,info,length);
profile=GetImageProfile(image,image_info->magick);
if (profile == (StringInfo *) NULL)
ThrowWriterException(CoderError,"NoAPP1DataIsAvailable");
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickCoreSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
(void) WriteBlob(image,GetStringInfoLength(profile),
profile=GetImageProfile(image,"icc");
if (profile == (StringInfo *) NULL)
ThrowWriterException(CoderError,"NoColorProfileIsAvailable");
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickCoreSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
(void) WriteBlob(image,GetStringInfoLength(profile),