summaryrefslogtreecommitdiff
path: root/source/fitz/load-tiff.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-03-28 15:17:27 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-04-03 21:21:44 +0200
commitef3cfb2a49b5be82d56d783f505319754dc65cb8 (patch)
treef299436312d6230c08289b61e9bad51a4dd31681 /source/fitz/load-tiff.c
parentd9f0fdfe1ac986816a3376ee0271f84fb549b0bf (diff)
downloadmupdf-ef3cfb2a49b5be82d56d783f505319754dc65cb8.tar.xz
Don't implicitly drop in fz_open_* chained filters.
Diffstat (limited to 'source/fitz/load-tiff.c')
-rw-r--r--source/fitz/load-tiff.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c
index 2da9e635..3dad8a82 100644
--- a/source/fitz/load-tiff.c
+++ b/source/fitz/load-tiff.c
@@ -309,12 +309,12 @@ tiff_decode_data(fz_context *ctx, struct tiff *tiff, const unsigned char *rp, un
rp = reversed;
}
+ fz_var(jpegtables);
fz_var(encstm);
fz_var(stm);
fz_try(ctx)
{
- /* each decoder will close this */
encstm = fz_open_memory(ctx, rp, rlen);
/* switch on compression to create a filter */
@@ -331,7 +331,7 @@ tiff_decode_data(fz_context *ctx, struct tiff *tiff, const unsigned char *rp, un
{
case 1:
/* stm already open and reading uncompressed data */
- stm = encstm;
+ stm = fz_keep_stream(ctx, encstm);
break;
case 2:
case 3:
@@ -385,7 +385,6 @@ tiff_decode_data(fz_context *ctx, struct tiff *tiff, const unsigned char *rp, un
stm = fz_open_thunder(ctx, encstm, tiff->imagewidth);
break;
default:
- stm = encstm;
fz_throw(ctx, FZ_ERROR_GENERIC, "unknown TIFF compression: %d", tiff->compression);
}
@@ -393,6 +392,8 @@ tiff_decode_data(fz_context *ctx, struct tiff *tiff, const unsigned char *rp, un
}
fz_always(ctx)
{
+ fz_drop_stream(ctx, jpegtables);
+ fz_drop_stream(ctx, encstm);
fz_drop_stream(ctx, stm);
fz_free(ctx, reversed);
}