summaryrefslogtreecommitdiff
path: root/source/fitz/load-tiff.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-04-30 03:38:10 +0800
committerSebastian Rasmussen <sebras@gmail.com>2017-04-30 04:43:21 +0800
commitb2c820e11bdec61fc38dde8d7d0fd3b35fc7ccfa (patch)
tree643604cb8932605ae0fc5dbf99846e744d24721e /source/fitz/load-tiff.c
parent58e7fcda85101e17dbe29185e55b74e22d20d4a3 (diff)
downloadmupdf-b2c820e11bdec61fc38dde8d7d0fd3b35fc7ccfa.tar.xz
tiff: Set k>0 for CCITT fax group 3 1D/2D compression.
Previously, if a TIFF file was encoded using CCITT fax group 3 compression and mixing 1D and 2D codes, the fax decoder was not instructed to parse the 1D/2D indication bit after EOL. This caused later issues when parsing the succeeding 1D/2D code, e.g. resulting in the decoder encountering a negative 1D code and returning with an error. Setting k>0 means the 1D/2D indication bit is parsed. The CCITT fax group 3 specification recommends setting k based on the vertical resolution. MuPDF's fax decoder depends only on if k is <0, 0 or >0, not its value (as recommended by the PDF specification). Therefore it is not necessary to use the vertical resolution to determine a particular value for k.
Diffstat (limited to 'source/fitz/load-tiff.c')
-rw-r--r--source/fitz/load-tiff.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c
index 4bc8be75..c8449dc9 100644
--- a/source/fitz/load-tiff.c
+++ b/source/fitz/load-tiff.c
@@ -332,7 +332,9 @@ tiff_decode_data(fz_context *ctx, struct tiff *tiff, unsigned char *rp, unsigned
case 3:
case 4:
stm = fz_open_faxd(ctx, stm,
- tiff->compression == 4 ? -1 : 0,
+ tiff->compression == 4 ? -1 :
+ tiff->compression == 2 ? 0 :
+ tiff->g3opts & 1,
0,
tiff->compression == 2,
tiff->imagewidth,