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
May 2012

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

2012.05.18 13:23 "TIFFGetField: count should be uint32_t (Bug in documentation)", by Sandro Mani
2012.05.18 14:27 "Re: TIFFGetField: count should be uint32_t (Bug in documentation)", by Bob Friesenhahn

2012.05.18 13:23 "TIFFGetField: count should be uint32_t (Bug in documentation)", by Sandro Mani

Hello,
according to [1], when querying multi-valued fields with TiffGetField, 
count should be of a 16-bit unsigned integer. However, in various places 
in the source libtiff source code, a 32-bit unsigned integer is used. 
Indeed, a nasty bug I encountered was caused by count being 16 bits wide:

  uint16_t count;
  uint32_t width;
  void* data;
  std::cout<<&width<<" "<<&count<<std::endl;

  TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width);
  std::cout<<width<<std::endl;

  TIFFGetField(tif, TIFFTAG_MODELTIEPOINT, &count, &data);
  std::cout<<width<<std::endl;

Output:
0x7fffa4d38a68 0x7fffa4d38a66
7721
0
=> Count overflowed into width

If my analysis is correct, I guess the documentation should be fixed.

Thanks,
Sandro

[1] http://www.remotesensing.org/libtiff/man/TIFFGetField.3tiff.html