summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/fitz/load-tiff.c12
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