fix handling of tags in custom directories which happen to match standard tags but are defined differently in the custom dir
This commit is contained in:
parent
047f4120df
commit
79a2449b27
@ -1,5 +1,10 @@
|
|||||||
2012-05-29 Frank Warmerdam <warmerdam@google.com>
|
2012-05-29 Frank Warmerdam <warmerdam@google.com>
|
||||||
|
|
||||||
|
* libtiff/tif_dir.c: avoid using specific set/get logic to process fields in custom directories,
|
||||||
|
like EXIF directories. This fixes problems like a tag "320" existing in a custom directory getting
|
||||||
|
processed as if it were a colormap when it isn't really. Damn the wide variety of argument formulations
|
||||||
|
to get/set functions for different tags!
|
||||||
|
|
||||||
* libtiff/tif_dir.c: Ensure that we keep track of when tif_rawdata
|
* libtiff/tif_dir.c: Ensure that we keep track of when tif_rawdata
|
||||||
is a pointer into an mmap()ed file via TIFF_BUFFERMMAP flag.
|
is a pointer into an mmap()ed file via TIFF_BUFFERMMAP flag.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tif_dir.c,v 1.109 2012-05-24 01:03:37 fwarmerdam Exp $ */
|
/* $Id: tif_dir.c,v 1.110 2012-05-30 04:58:13 fwarmerdam Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988-1997 Sam Leffler
|
* Copyright (c) 1988-1997 Sam Leffler
|
||||||
@ -161,8 +161,20 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
int status = 1;
|
int status = 1;
|
||||||
uint32 v32, i, v;
|
uint32 v32, i, v;
|
||||||
char* s;
|
char* s;
|
||||||
|
const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
|
||||||
|
uint32 standard_tag = tag;
|
||||||
|
|
||||||
switch (tag) {
|
/*
|
||||||
|
* We want to force the custom code to be used for custom
|
||||||
|
* fields even if the tag happens to match a well known
|
||||||
|
* one - important for reinterpreted handling of standard
|
||||||
|
* tag values in custom directories (ie. EXIF)
|
||||||
|
*/
|
||||||
|
if (fip->field_bit == FIELD_CUSTOM) {
|
||||||
|
standard_tag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (standard_tag) {
|
||||||
case TIFFTAG_SUBFILETYPE:
|
case TIFFTAG_SUBFILETYPE:
|
||||||
td->td_subfiletype = (uint32) va_arg(ap, uint32);
|
td->td_subfiletype = (uint32) va_arg(ap, uint32);
|
||||||
break;
|
break;
|
||||||
@ -427,7 +439,6 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
default: {
|
default: {
|
||||||
TIFFTagValue *tv;
|
TIFFTagValue *tv;
|
||||||
int tv_size, iCustom;
|
int tv_size, iCustom;
|
||||||
const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This can happen if multiple images are open with different
|
* This can happen if multiple images are open with different
|
||||||
@ -799,8 +810,20 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
{
|
{
|
||||||
TIFFDirectory* td = &tif->tif_dir;
|
TIFFDirectory* td = &tif->tif_dir;
|
||||||
int ret_val = 1;
|
int ret_val = 1;
|
||||||
|
uint32 standard_tag = tag;
|
||||||
|
const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We want to force the custom code to be used for custom
|
||||||
|
* fields even if the tag happens to match a well known
|
||||||
|
* one - important for reinterpreted handling of standard
|
||||||
|
* tag values in custom directories (ie. EXIF)
|
||||||
|
*/
|
||||||
|
if (fip->field_bit == FIELD_CUSTOM) {
|
||||||
|
standard_tag = 0;
|
||||||
|
}
|
||||||
|
|
||||||
switch (tag) {
|
switch (standard_tag) {
|
||||||
case TIFFTAG_SUBFILETYPE:
|
case TIFFTAG_SUBFILETYPE:
|
||||||
*va_arg(ap, uint32*) = td->td_subfiletype;
|
*va_arg(ap, uint32*) = td->td_subfiletype;
|
||||||
break;
|
break;
|
||||||
@ -975,8 +998,6 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
const TIFFField* fip =
|
|
||||||
TIFFFindField(tif, tag, TIFF_ANY);
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user