AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
March 2005

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2005.03.03 17:19 "LibTIFF question", by Kalman Miklos
2005.03.03 17:48 "Re: LibTIFF question", by Frank Warmerdam
2005.03.03 18:04 "Re: LibTIFF question", by Bob Friesenhahn
2005.03.03 18:11 "Re: LibTIFF question", by Kalman Miklos
2005.03.03 18:28 "Re: LibTIFF question", by Frank Warmerdam
2005.03.03 19:19 "Re: LibTIFF question", by Bob Friesenhahn
2005.03.03 19:27 "Re: LibTIFF question", by Frank Warmerdam
2005.03.15 00:38 "Re: LibTIFF question", by Joris Van Damme
2005.03.15 07:56 "Re: LibTIFF question", by Frank Warmerdam
2005.03.15 16:06 "Re: LibTIFF question", by Joris Van Damme
2005.03.15 16:15 "Re: LibTIFF question", by Frank Warmerdam
2005.03.15 16:34 "Re: LibTIFF question", by Bob Friesenhahn

2005.03.15 00:38 "Re: LibTIFF question", by Joris Van Damme

Frank,

Frank wrote:
> I think you should be doing something like:
>
>   uint16 count;
>   int *data = NULL;
>
>   TIFFGetField( m_TIFF, 50653, &count, &data );

That is almost a perfect solution, thanks to the so-called auto-registration.
However, one thing seems missing, being the datatype. Suppose this method is
used to retrieve, for example, the ModelPixelScaleTag tag value. If the calling
code simply assumes the datatype of the returned value is DOUBLE, and only
double-checks the count, it's bound to overrun the buffer pointed to by 'data'
and crash badly if it ever encounters a TIFF file where this same tag id stores
3 byte values.

Due to the number of private tags, and due to the fact that at one time
registration was hard, I expect some tag uses are unregistered and situations
like these are likely. Besides, we need to protect ourselves from this mishap
even if it should not be likely.

So my question is, is there a way to retrieve the datatype of these
auto-registered tags? Am I right in thinking that TIFFFindFieldInfo with
TIFF_ANY for the third parameter returns the 'registration' structure as build
by this auto-registration scheme? Is checking the FieldType member of this
structure good and sufficient to protect the calling code from the above
mentioned mishap?



Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html