diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2017-09-30 17:56:20 +0200 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2017-10-02 14:43:04 +0200 |
commit | 80e021dcc5aefd48277697db817c65142e182403 (patch) | |
tree | 1d849fc920acc07adac6df419b46c6f971aff174 /source/pdf/pdf-stream.c | |
parent | 0ef7cb983c4325156e08525381542ae3ada04720 (diff) | |
download | mupdf-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.c | 12 |
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 |