AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2004.01.11 14:43 "[Tiff] bugs in 3.6.1", by Gerben Koopmans
2004.01.11 15:22 "Re: [Tiff] bugs in 3.6.1", by Andrey Kiselev

2004.01.11 14:43 "[Tiff] bugs in 3.6.1", by Gerben Koopmans

Hello all,

I found and fixed some bugs in version 3.6.1:

bug: fatal error if more than one directory with custom tags is read
cause: incomplete cleanup
fix:

TIFFFreeDirectory:
..
    /* Cleanup custom tag values */
    for( i = 0; i < td->td_customValueCount; i++ )

        _TIFFfree( td->td_customValues[i].value );
        td->td_customValueCount = 0;            /* added by GK */

    if( td->td_customValues != NULL )
        _TIFFfree( td->td_customValues );
..

bug: fatal error if a single custom value of undefined type is read

cause: _TIFFCreateAnonFieldInfo sets field_passcount, which TIFFFetchNormalTag assumes to be zero

fix:

TIFFFetchNormalTag:
..
        case TIFF_UNDEFINED: /* bit of a cheat... */
            { char c[2];

                if( (ok = (TIFFFetchString(tif, dp, c) != 0)) != 0 ){
                        c[1] = '\0';            /* XXX paranoid */

                        ok = fip->field_passcount ?                     /* may have any value! (GK) */

                              TIFFSetField(tif, dp->tdir_tag, 1, c)
                            : TIFFSetField(tif, dp->tdir_tag, c);
                }
            }
            break;
..

Inconsistent and therefore confusing is that reading the standard software tag results in a custom value being set. Must have been a bug in previous editions.

Gerben Koopmans
KEMA Power Generation & Sustainables
KEMA Nederland B.V.
P. O. Box 9035
6800 ET Arnhem
The Netherlands
Registered Arnhem 09080262
Telephone +31 26 3 56 32 93
Telefax +31 26 3 56 20 12
e-mail: gerben.koopmans@kema.nl
Internet: http://www.kema-kps.nl