@@ -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 );
0 commit comments