summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-stream.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-09-30 17:56:20 +0200
committerSebastian Rasmussen <sebras@gmail.com>2017-10-02 14:43:04 +0200
commit80e021dcc5aefd48277697db817c65142e182403 (patch)
tree1d849fc920acc07adac6df419b46c6f971aff174 /source/pdf/pdf-stream.c
parent0ef7cb983c4325156e08525381542ae3ada04720 (diff)
downloadmupdf-80e021dcc5aefd48277697db817c65142e182403.tar.xz
Drop stream upon error in inline stream.
Diffstat (limited to 'source/pdf/pdf-stream.c')
-rw-r--r--source/pdf/pdf-stream.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/pdf/pdf-stream.c b/source/pdf/pdf-stream.c
index 1dea7907..30c7fbbc 100644
--- a/source/pdf/pdf-stream.c
+++ b/source/pdf/pdf-stream.c
@@ -380,6 +380,7 @@ pdf_open_inline_stream(fz_context *ctx, pdf_document *doc, pdf_obj *stmobj, int
{
pdf_obj *filters;
pdf_obj *params;
+ fz_off_t offset;
filters = pdf_dict_geta(ctx, stmobj, PDF_NAME_Filter, PDF_NAME_F);
params = pdf_dict_geta(ctx, stmobj, PDF_NAME_DecodeParms, PDF_NAME_DP);
@@ -394,7 +395,16 @@ pdf_open_inline_stream(fz_context *ctx, pdf_document *doc, pdf_obj *stmobj, int
if (imparams)
imparams->type = FZ_IMAGE_RAW;
- return fz_open_null(ctx, chain, length, fz_tell(ctx, chain));
+
+ fz_try(ctx)
+ offset = fz_tell(ctx, chain);
+ fz_catch(ctx)
+ {
+ fz_drop_stream(ctx, chain);
+ fz_rethrow(ctx);
+ }
+
+ return fz_open_null(ctx, chain, length, offset);
}
void