Skip to content

Commit b61d35e

Browse files
author
Cristy
committed
https://github.com/ImageMagick/ImageMagick/issues/298
1 parent b1c2114 commit b61d35e

File tree

3 files changed

+31
-19
lines changed

3 files changed

+31
-19
lines changed

Diff for: MagickCore/property.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ MagickExport MagickBooleanType CloneImageProperties(Image *image,
213213
%
214214
% DefineImageProperty() associates an assignment string of the form
215215
% "key=value" with an artifact or options. It is equivelent to
216-
% SetImageProperty()
216+
% SetImageProperty().
217217
%
218218
% The format of the DefineImageProperty method is:
219219
%
@@ -3962,7 +3962,7 @@ MagickExport MagickBooleanType SetImageProperty(Image *image,
39623962
{
39633963
/*
39643964
Do not 'set' single letter properties - read only shorthand.
3965-
*/
3965+
*/
39663966
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
39673967
"SetReadOnlyProperty","`%s'",property);
39683968
return(MagickFalse);

Diff for: coders/tiff.c

+28-15
Original file line numberDiff line numberDiff line change
@@ -631,42 +631,54 @@ static void TIFFGetProperties(TIFF *tiff,Image *image,ExceptionInfo *exception)
631631
unsigned long
632632
*tietz;
633633

634-
635-
if (TIFFGetField(tiff,TIFFTAG_ARTIST,&text) == 1)
634+
if ((TIFFGetField(tiff,TIFFTAG_ARTIST,&text) == 1) &&
635+
(text != (char *) NULL))
636636
(void) SetImageProperty(image,"tiff:artist",text,exception);
637-
if (TIFFGetField(tiff,TIFFTAG_COPYRIGHT,&text) == 1)
637+
if ((TIFFGetField(tiff,TIFFTAG_COPYRIGHT,&text) == 1) &&
638+
(text != (char *) NULL))
638639
(void) SetImageProperty(image,"tiff:copyright",text,exception);
639-
if (TIFFGetField(tiff,TIFFTAG_DATETIME,&text) == 1)
640+
if ((TIFFGetField(tiff,TIFFTAG_DATETIME,&text) == 1) &&
641+
(text != (char *) NULL))
640642
(void) SetImageProperty(image,"tiff:timestamp",text,exception);
641-
if (TIFFGetField(tiff,TIFFTAG_DOCUMENTNAME,&text) == 1)
643+
if ((TIFFGetField(tiff,TIFFTAG_DOCUMENTNAME,&text) == 1) &&
644+
(text != (char *) NULL))
642645
(void) SetImageProperty(image,"tiff:document",text,exception);
643-
if (TIFFGetField(tiff,TIFFTAG_HOSTCOMPUTER,&text) == 1)
646+
if ((TIFFGetField(tiff,TIFFTAG_HOSTCOMPUTER,&text) == 1) &&
647+
(text != (char *) NULL))
644648
(void) SetImageProperty(image,"tiff:hostcomputer",text,exception);
645-
if (TIFFGetField(tiff,TIFFTAG_IMAGEDESCRIPTION,&text) == 1)
649+
if ((TIFFGetField(tiff,TIFFTAG_IMAGEDESCRIPTION,&text) == 1) &&
650+
(text != (char *) NULL))
646651
(void) SetImageProperty(image,"comment",text,exception);
647-
if (TIFFGetField(tiff,TIFFTAG_MAKE,&text) == 1)
652+
if ((TIFFGetField(tiff,TIFFTAG_MAKE,&text) == 1) &&
653+
(text != (char *) NULL))
648654
(void) SetImageProperty(image,"tiff:make",text,exception);
649-
if (TIFFGetField(tiff,TIFFTAG_MODEL,&text) == 1)
655+
if ((TIFFGetField(tiff,TIFFTAG_MODEL,&text) == 1) &&
656+
(text != (char *) NULL))
650657
(void) SetImageProperty(image,"tiff:model",text,exception);
651-
if (TIFFGetField(tiff,TIFFTAG_OPIIMAGEID,&count,&text) == 1)
658+
if ((TIFFGetField(tiff,TIFFTAG_OPIIMAGEID,&count,&text) == 1) &&
659+
(text != (char *) NULL))
652660
{
653661
if (count >= MagickPathExtent)
654662
count=MagickPathExtent-1;
655663
(void) CopyMagickString(message,text,count+1);
656664
(void) SetImageProperty(image,"tiff:image-id",message,exception);
657665
}
658-
if (TIFFGetField(tiff,TIFFTAG_PAGENAME,&text) == 1)
666+
if ((TIFFGetField(tiff,TIFFTAG_PAGENAME,&text) == 1) &&
667+
(text != (char *) NULL))
659668
(void) SetImageProperty(image,"label",text,exception);
660-
if (TIFFGetField(tiff,TIFFTAG_SOFTWARE,&text) == 1)
669+
if ((TIFFGetField(tiff,TIFFTAG_SOFTWARE,&text) == 1) &&
670+
(text != (char *) NULL))
661671
(void) SetImageProperty(image,"tiff:software",text,exception);
662-
if (TIFFGetField(tiff,33423,&count,&text) == 1)
672+
if ((TIFFGetField(tiff,33423,&count,&text) == 1) &&
673+
(text != (char *) NULL))
663674
{
664675
if (count >= MagickPathExtent)
665676
count=MagickPathExtent-1;
666677
(void) CopyMagickString(message,text,count+1);
667678
(void) SetImageProperty(image,"tiff:kodak-33423",message,exception);
668679
}
669-
if (TIFFGetField(tiff,36867,&count,&text) == 1)
680+
if ((TIFFGetField(tiff,36867,&count,&text) == 1) &&
681+
(text != (char *) NULL))
670682
{
671683
if (count >= MagickPathExtent)
672684
count=MagickPathExtent-1;
@@ -695,7 +707,8 @@ static void TIFFGetProperties(TIFF *tiff,Image *image,ExceptionInfo *exception)
695707
default:
696708
break;
697709
}
698-
if (TIFFGetField(tiff,37706,&length,&tietz) == 1)
710+
if ((TIFFGetField(tiff,37706,&length,&tietz) == 1) &&
711+
(tietz != (unsigned long *) NULL))
699712
{
700713
(void) FormatLocaleString(message,MagickPathExtent,"%lu",tietz[0]);
701714
(void) SetImageProperty(image,"tiff:tietz_offset",message,exception);

Diff for: coders/txt.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,7 @@ static MagickBooleanType WriteTXTImage(const ImageInfo *image_info,Image *image,
793793
(void) WriteBlobString(image,buffer);
794794
(void) CopyMagickString(tuple,"(",MagickPathExtent);
795795
if (pixel.colorspace == GRAYColorspace)
796-
ConcatenateColorComponent(&pixel,GrayPixelChannel,compliance,
797-
tuple);
796+
ConcatenateColorComponent(&pixel,GrayPixelChannel,compliance,tuple);
798797
else
799798
{
800799
ConcatenateColorComponent(&pixel,RedPixelChannel,compliance,tuple);

0 commit comments

Comments
 (0)