Bug 2215 - Incorrect uses of TIFFGetField where TIFFGetFieldDefaulted is needed
: Incorrect uses of TIFFGetField where TIFFGetFieldDefaulted is needed
Status: RESOLVED FIXED
: libtiff
default
: 3.9.0
: All All
: P2 normal
: ---
Assigned To:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2010-06-14 11:28 by
Modified: 2010-12-14 19:51 (History)


Attachments
TIFFGetField->TIFFGetFieldDefaulted in a few places (1.59 KB, patch)
2010-06-14 11:28, Tom Lane
Details | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2010-06-14 11:28:21
Created an attachment (id=395) [details]
TIFFGetField->TIFFGetFieldDefaulted in a few places

I found three places in tif_strip.c that assume that
TIFFGetField(TIFFTAG_YCBCRSUBSAMPLING) will always succeed.  This is not
correct; what they actually want is TIFFGetFieldDefaulted, which can be assumed
to succeed since there's a place to get the defaults if no such tag was
provided by the input file.

I attach a patch that fixes the immediate problem in 3.9.2, but I would suggest
a generic review of the code to see if anyplace else needs a similar change. 
Or maybe a more radical bit of future-proofing is called for --- should
TIFFGetFieldDefaulted even be a separate function, or should TIFFGetField just
always return defaults if some exist?
------- Comment #1 From 2010-12-14 19:51:20 -------
I've committed your patch to the CVS 3.9 branch.  I have not performed a full
code audit as suggested, however.  These changes appear to already have been
made in CVS HEAD, so they don't apply there.  Thanks.