Bug 2073 - TIFFWriteScanline corrupts buffer when compression with predication is enabled
: TIFFWriteScanline corrupts buffer when compression with predication is enabled
Status: RESOLVED LATER
: libtiff
default
: 4.0.0
: PC Linux
: P2 normal
: ---
Assigned To:
:
:
: migrated_to_gitlab
:
:
  Show dependency treegraph
 
Reported: 2009-06-30 18:14 by
Modified: 2019-10-01 14:19 (History)


Attachments
test progam (1.90 KB, text/x-csrc)
2009-06-30 18:14, William B Thompson
Details


Note

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


Description From 2009-06-30 18:14:15
Created an attachment (id=319) [details]
test progam

TIFFWriteScanline corrupts the input buffer in the calling program with LZW and
deflate (zip) compression when horizontal prediction is enabled for integer
values or floating point prediction is enable for floating point values.  This
occurs with both libtiff 3.8.2 and 4.0.0beta3 (CVS).

A test program for the integer case is attached.  It should be run with and
without the "-p" flag.

The declaration of TIFFWriteScanline does not include the "const" qualifier for
the buffer argument, so modifying values in the buffer is not, strictly
speaking, in violation of the specification.  It seems to me, however, that it
is bad practice.  It is certainly bad practice when not described in the man
page for TIFFWriteScanline.

One might argue that it is rare to rewrite or otherwise reuse an output buffer
that has just been written to a file.  I can testify from personal experience
that it might be rare, but it does occur (and is a pain to track down when it
happens).
------- Comment #1 From 2019-10-01 14:19:19 -------
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.