[BZ#2660] Unintended type replacement for private tags (e.g.: RichTIFFIPTC)
Submitted by Andreas R. (andreas dot romeyke at slub-dresden dot de) on 2017-01-16 09:28
Link to original bug (#2660)
Description
Dear Developer,
if you read a Tiff-TAG with TIFFGetField(), then change its value calling TIFFSetField() and at the end call TIFFWriteDirectory(). The call to TIFFWriteDirectory reports warnings like the following line and filters out all these affected tags:
TIFFFetchNormalTag: Warning, Incompatible type for "RichTIFFIPTC"; tag ignored.
The problem is that libtiff defines datatype TIFF_LONG for RICHTIFFIPTC, but in the original file it has datatype TIFF_UNDEFINED. The resulting tiff-file lacks the Tag RICHTIFFIPTC then.
As a minimal example for this problem, please check https://github.com/SLUB-digitalpreservation/fixit_tiff/blob/master/src/cleanup_icc_header.c (lines 55 ff.)
The expected behaviour is:
* give a warning about wrong type,
* leave the private tag untouched and stupidly copy it to the new output file
With best regards
Andreas