Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 883641 - media-libs/tiff-4.4.0: regression causes corrupt TIFFs written by net-misc/hylafaxplus
Summary: media-libs/tiff-4.4.0: regression causes corrupt TIFFs written by net-misc/hy...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Codec Project
URL:
Whiteboard:
Keywords: PATCH
Depends on: 883805
Blocks:
  Show dependency tree
 
Reported: 2022-11-29 18:32 UTC by cmwatts
Modified: 2022-12-01 07:17 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Proposed patch (tiff-4.4.0_rc1-fix-tiff-append-ec.patch,863 bytes, patch)
2022-11-29 21:16 UTC, cmwatts
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description cmwatts 2022-11-29 18:32:02 UTC
A regression has been identified in media-libs/tiff-4.4.0 and media-libs/tiff-4.4.0-r1 that causes corrupt TIFF files to be written by hylafaxplus when a TIFF page image contains multiple strips (multiple blocks of data for a single page in fax parlance).

This has been reported to the TIFF library maintainers upstream and a merge that fixes the issue is available at:

https://gitlab.com/libtiff/libtiff/-/merge_requests/430

The original issue is at:

https://gitlab.com/libtiff/libtiff/-/issues/489

A patch that corrects this issue is as follows. Request that an updated media-libs/tiff ebuild be created that includes this patch until current upstream includes it.

https://gitlab.com/libtiff/libtiff/-/merge_requests/430

Regression in tif_write.c causes hylafax to write corrupt TIFFs
when multi-strip (multi-block) page images are written

Fixes: https://gitlab.com/libtiff/libtiff/-/issues/489
--- a/libtiff/tif_write.c	2022-04-22 09:51:48.000000000 -0700
+++ b/libtiff/tif_write.c	2022-11-29 08:17:10.692592173 -0800
@@ -341,10 +341,13 @@
 			return ((tmsize_t) -1);
 	}
 
-	tif->tif_curstrip = strip;
+    if (tif->tif_curstrip != strip)
+    {
+        tif->tif_curstrip = strip;
 
-	/* this informs TIFFAppendToStrip() we have changed or reset strip */
-	tif->tif_curoff = 0;
+        /* this informs TIFFAppendToStrip() we have changed or reset strip */
+        tif->tif_curoff = 0;
+    }
 
         if (td->td_stripsperimage == 0) {
                 TIFFErrorExt(tif->tif_clientdata, module,"Zero strips per image");

Reproducible: Always

Steps to Reproduce:
Receive a fax containing more than one 'block' (64Kb data) in a single page image via hylafaxplus when media-libs/tiff-4.4.0 is installed.
Actual Results:  
Resulting TIFF is corrupt and can be verified by its producing line-length mismatch warnings when run through tiffinfo -D.

Expected Results:  
Expect working TIFF image (no errors or warnings from tiffinfo -D on resulting TIFF)

Patch provided.
Comment 1 cmwatts 2022-11-29 21:16:20 UTC
Created attachment 838375 [details, diff]
Proposed patch
Comment 2 Larry the Git Cow gentoo-dev 2022-12-01 07:17:02 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=33944343462c9aa5a0a23b4a296074d0bc62c5c2

commit 33944343462c9aa5a0a23b4a296074d0bc62c5c2
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-12-01 07:15:54 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-12-01 07:16:56 +0000

    media-libs/tiff: backport fix for hylafaxplus regression
    
    Closes: https://bugs.gentoo.org/883641
    Signed-off-by: Sam James <sam@gentoo.org>

 .../files/tiff-4.4.0-hylafaxplus-regression.patch  |  34 +++++++
 media-libs/tiff/tiff-4.4.0-r2.ebuild               | 102 +++++++++++++++++++++
 2 files changed, 136 insertions(+)