check for unknown exif tags

exif_tag_get_name() can return NULL for unknown tags, check
This commit is contained in:
John Cupitt 2015-07-23 15:01:44 +01:00
parent 6fa6ad40aa
commit c2e8406ca0

View File

@ -487,20 +487,23 @@ typedef struct _VipsExif {
static void
attach_exif_entry( ExifEntry *entry, VipsExif *ve )
{
char name_txt[256];
VipsBuf name = VIPS_BUF_STATIC( name_txt );
const char *tag_name;
char vips_name_txt[256];
VipsBuf vips_name = VIPS_BUF_STATIC( vips_name_txt );
char value_txt[256];
VipsBuf value = VIPS_BUF_STATIC( value_txt );
vips_buf_appendf( &name, "exif-ifd%d-%s",
exif_entry_get_ifd( entry ),
exif_tag_get_name( entry->tag ) );
if( !(tag_name = exif_tag_get_name( entry->tag )) )
return;
vips_buf_appendf( &vips_name, "exif-ifd%d-%s",
exif_entry_get_ifd( entry ), tag_name );
vips_exif_to_s( ve->ed, entry, &value );
/* Can't do anything sensible with the error return.
*/
(void) vips_image_set_string( ve->image,
vips_buf_all( &name ), vips_buf_all( &value ) );
vips_buf_all( &vips_name ), vips_buf_all( &value ) );
}
static void