AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2003.08.07 01:12 "[Tiff] Custom tags", by Ashley Dreier
2003.08.07 06:11 "[Tiff] Custom tags", by Andrey Kiselev
2003.08.07 23:59 "[Tiff] Custom tags", by Ashley Dreier
2003.08.07 16:40 "[Tiff] Custom tags", by Andrey Kiselev
2003.08.11 05:09 "[Tiff] Custom tags", by Ashley Dreier
2003.08.11 02:40 "[Tiff] Corection [was: ld.so.1, TIFFmalloc not found]", by Pushkar Pradhan
2003.08.10 04:43 "[Tiff] ld.so.1, TIFFmalloc not found", by Pushkar Pradhan
2003.08.10 05:39 "[Tiff] ld.so.1, TIFFmalloc not found", by Tom Kacvinsky
2003.08.10 05:53 "[Tiff] ld.so.1, TIFFmalloc not found", by Pushkar Pradhan
2003.08.10 13:17 "[Tiff] ld.so.1, TIFFmalloc not found", by Tom Kacvinsky
2003.08.10 16:00 "[Tiff] Corection [was: ld.so.1, TIFFmalloc not found]", by Tom Kacvinsky
2003.08.12 07:48 "[Tiff] Custom tags", by Andrey Kiselev
2003.08.07 06:36 "[Tiff] Custom tags", by Ashley Dreier

2003.08.11 05:09 "[Tiff] Custom tags", by Ashley Dreier

Hi Andrey.

Further to my previous posting, I now have the following situation. Writes for non-ascii custom tags of size '1' work fine. If however the size is set to 2 (or higher presumably - i.e. not TIFF_VARIABLE) then I get a corrupted TIFF directory when writing the directory structure. Data from 'purify' indicates that the problem again is in TIFFWriteNormalTag(). The relevant code snippet is:

case TIFF_LONG:
case TIFF_SLONG:
        if (wc > 1) {
                uint32* lp;
                if (wc == (u_short) TIFF_VARIABLE)
                        TIFFGetField(tif, fip->field_tag, &wc, &lp);
                else
                        TIFFGetField(tif, fip->field_tag, &lp);
                if (!WRITEF(TIFFWriteLongArray, lp))
                        return (0);
        } else {
                if (fip->field_passcount) {
                        uint32* lp;
                        TIFFGetField(tif, fip->field_tag, &wc, &lp);
                        if (!WRITEF(TIFFWriteLongArray, lp))
                                return 0;
                } else {
                        /* XXX handle LONG->SHORT conversion */
                        TIFFGetField(tif, fip->field_tag,
                                     &dir->tdir_offset);
                }
        }
        break;

In my case, 'wc' is set to 2, and fip->field_passcount is also set. I get an 'uninitialised read error' when the WRITEF macro is called, presumably because it's trying to write 2 LONG values out when the reference pointer is addressing the wrong thing. I think the correct code should also look at the 'field_passcount' field as is done in the case where 'wc <= 1'.

Here's my 'diff' output (i.e. cvs diff tif_dirwrite.c) for the LONG custom tag type.

diff -u -w -r1.16 tif_dirwrite.c

--- tif_dirwrite.c      7 Aug 2003 16:39:06 -0000       1.16
+++ tif_dirwrite.c      11 Aug 2003 05:07:35 -0000

@@ -477,6 +477,8 @@
                        uint32* lp;
                        if (wc == (u_short) TIFF_VARIABLE)
                                TIFFGetField(tif, fip->field_tag, &wc, &lp);

+                       else if (fip->field_passcount)
+                               TIFFGetField(tif, fip->field_tag, &wc, &lp);

else
        TIFFGetField(tif, fip->field_tag, &lp);
if (!WRITEF(TIFFWriteLongArray, lp))

The case is probably the same for all other custom tag types also.

Regards,

Ashley.

On Fri, 8 Aug 2003 09:59:51 +1000

> _______________________________________________
> Tiff mailing list
> Tiff@remotesensing.org
> http://remotesensing.org/mailman/listinfo/tiff
>

--
Ashley J. Dreier. Email: Ashley.Dreier@csiro.au

CSIRO Manufacturing and Infrastructure Tech, Phone: +61 3 9662 7799
Locked Bag No. 9,                            Fax:   +61 3 9662 7851

Preston, Vic, 3072, Australia.
URL: http://www.msa.cmst.csiro.au/cmst/automation/staff/ajd