Bug 2175 - _TIFFVGetField and _TIFFVSetField using different count types
: _TIFFVGetField and _TIFFVSetField using different count types
Status: RESOLVED LATER
: libtiff
default
: 3.9.0
: PC Windows XP
: P2 major
: ---
Assigned To:
:
:
: migrated_to_gitlab
:
:
  Show dependency treegraph
 
Reported: 2010-04-15 18:17 by
Modified: 2019-10-01 14:19 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2010-04-15 18:17:31
This bug actually refers to release 3.9.2.  The version wasn't listed in the
version list box.

In trying to figure out how to put structures into tags, I discovered what
appears to be a coding error between count when issued on SetField and received
in a pointer on GetField when pass_count is TRUE and field_writecount is not
TIFF_VARIABLE2 (i.e., probably TIFF_VARIABLE).  I posit that TIFF_VARIABLE
should be a unint16 value and therefore _TIFFVSetField is wrong.  See below.

First the code from _TIFFVSetField in tif_dir.c at line 467:

            if(fip->field_passcount) {
            if (fip->field_writecount == TIFF_VARIABLE2)
            tv->count = (uint32) va_arg(ap, uint32);
            else
            tv->count = (int) va_arg(ap, int);  /// BUG?  
        } else if (fip->field_writecount == TIFF_VARIABLE
               || fip->field_writecount == TIFF_VARIABLE2)
        tv->count = 1;
        else if (fip->field_writecount == TIFF_SPP)
        tv->count = td->td_samplesperpixel;
        else
                tv->count = fip->field_writecount;

Next the code from _TIFFVGetField in tif_dir.c at line 855: 

    if (fip->field_passcount) {
        if (fip->field_readcount == TIFF_VARIABLE2) 
            *va_arg(ap, uint32*) = (uint32)tv->count;
        else    /* Assume TIFF_VARIABLE */
            *va_arg(ap, uint16*) = (uint16)tv->count; /// BUG?
        *va_arg(ap, void **) = tv->value;
        ret_val = 1;
------- Comment #1 From 2019-10-01 14:19:22 -------
Bugzilla is no longer used for tracking libtiff issues. Remaining open tickets,
such as this one, have been migrated to the libtiff GitLab instance at
https://gitlab.com/libtiff/libtiff/issues .

The migrated tickets have their summary prefixed with [BZ#XXXX] where XXXX is
the initial Bugzilla issue number.