AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2014.07.01 11:12 "[Tiff] Possible bug in tiff_dirread.c? Or user error?", by Romeyke, Andreas
2014.07.01 15:56 "Re: [Tiff] Possible bug in tiff_dirread.c? Or user error?", by Joris Van Damme
2014.07.01 16:14 "AW: [Tiff] Possible bug in tiff_dirread.c? Or user error?", by Romeyke, Andreas
2014.07.01 16:58 "Re: [Tiff] Possible bug in tiff_dirread.c? Or user error?", by Joris Van Damme
2014.07.01 17:10 "Re: [Tiff] Possible bug in tiff_dirread.c? Or user error?", by Joris Van Damme
2014.07.02 10:45 "Re: [Tiff] Possible bug in tiff_dirread.c? Or user error?", by
2014.07.16 13:31 "Re: [Tiff] Error while opening tiff - fstat64.c", by Edward Lam
2014.07.16 06:57 "[Tiff] Error while opening tiff - fstat64.c", by h4ever
2014.07.16 13:53 "Re: [Tiff] Error while opening tiff - fstat64.c", by Bob Friesenhahn

2014.07.01 11:12 "[Tiff] Possible bug in tiff_dirread.c? Or user error?", by Romeyke, Andreas

Dear libtiff-developers,

because I am using libtiff as a base library to build a fixing-tool for longterm preservation (see https://github.com/SLUB-digitalpreservation/fixit_tiff), I stumbled across the following problem.

The tool has a mode to eliminate all tags in a tiff-file, which are not part of baseline-TIFF. In a TIFF-file, which is organized in stripes, I removed the tags 324 (TileOffsets) and 325 (TileByteCounts) with the following code (cleanup_baseline.c):

/* iterate through all tiff-tags in tiff file
     * delete all tags not in baselinetags
     */
    for (tagidx=0; tagidx < tag_counter; tagidx++) {
      printf ("found tag %i [0x%x] (%i)\n", tags[tagidx],tags[tagidx], tagidx);
      int found = 0;
      int baseline_index=0;
      for (baseline_index = 0; baseline_index < count_of_baselinetags; baseline_index++) {
        if (tags[tagidx] == baselinetags[baseline_index]) {
          printf ("DEBUG tag=%i base=%i idx=%i\n", tags[tagidx], baselinetags[baseline_index], baseline_index);
          found = 1;
          break;
        }
      }
      if (found == 0 ) {
        if (FLAGGED == flag_be_verbose) printf("removed tag %i\n", tags[tagidx]);
        TIFFUnsetField(tif, tags[tagidx]);
      }
    }

Then I call TIFFRewriteDirectory() which reports this error message: "MissingRequired: TIFF directory is missing required "StripOffsets" field."

The message is strange, because I only unset the TileOffsets and TileByteCounts tags.

To reproduce the problem, do following:

I hope, you could point me, where I am wrong. I have doublechecked the TIFF6.0 specification and rechecked my code.

Thanks in advance,

With best regards,

Andreas Romeyke
project member “long-term preservation“

Saxon State- and University Library Dresden (SLUB)
Department 2 (IT), Division 2.3 (network and data security)
Zellescher Weg 18 | 01069 Dresden
phone: +49 351 4677 216
E-Mail: Andreas.Romeyke@slub-dresden.de
http://www.slub-dresden.de/ | @slubdresden