diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-09-25 15:34:18 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-09-26 19:06:36 +0800 |
commit | 321103e327369fcf0ac5d6617e771989a695c516 (patch) | |
tree | c26be30e634cf8a23df495cddad84f24fe92003e /source | |
parent | 3059b6908208fbb9547e6876332a5b42a6406d1a (diff) | |
download | mupdf-321103e327369fcf0ac5d6617e771989a695c516.tar.xz |
tiff: Estimate uncompressed strip sizes if missing.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/load-tiff.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c index 2ead2e28..2f90aa5e 100644 --- a/source/fitz/load-tiff.c +++ b/source/fitz/load-tiff.c @@ -862,6 +862,18 @@ fz_decode_tiff_samples(fz_context *ctx, struct tiff *tiff) if (tiff->rowsperstrip > tiff->imagelength) tiff->rowsperstrip = tiff->imagelength; + /* some creators don't write byte counts for uncompressed images */ + if (tiff->compression == 1) + { + if (!tiff->stripbytecounts) + { + tiff->stripbytecountslen = (tiff->imagelength + tiff->rowsperstrip - 1) / tiff->rowsperstrip; + tiff->stripbytecounts = fz_malloc_array(ctx, tiff->stripbytecountslen, sizeof(unsigned)); + for (i = 0; i < tiff->stripbytecountslen; i++) + tiff->stripbytecounts[i] = tiff->rowsperstrip * tiff->stride; + } + } + if (tiff->rowsperstrip && tiff->stripoffsets && tiff->stripbytecounts) fz_decode_tiff_strips(ctx, tiff); else |