summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-stream.c
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2014-01-09 19:06:31 +0100
committerRobin Watts <robin.watts@artifex.com>2014-01-09 18:30:44 +0000
commit5249664dd8178e985b4ef47af6e1772b4c7665e7 (patch)
treea776b7b2dfae3b0a590a78432b86f19dde38273a /source/pdf/pdf-stream.c
parentbf20683f737a39ccb0e8c74735fdd6805025c987 (diff)
downloadmupdf-5249664dd8178e985b4ef47af6e1772b4c7665e7.tar.xz
prevent two further heap access violations
pdf_open_raw_renumbered_stream and pdf_open_image_stream both have the same issue that 98a111c8e49916f8f5ac21d11f4627540f9ddd49 fixes.
Diffstat (limited to 'source/pdf/pdf-stream.c')
-rw-r--r--source/pdf/pdf-stream.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/source/pdf/pdf-stream.c b/source/pdf/pdf-stream.c
index 0f568f16..e2b8c47e 100644
--- a/source/pdf/pdf-stream.c
+++ b/source/pdf/pdf-stream.c
@@ -365,10 +365,9 @@ pdf_open_raw_renumbered_stream(pdf_document *doc, int num, int gen, int orig_num
if (num < 0 || num >= pdf_xref_len(doc))
fz_throw(doc->ctx, FZ_ERROR_GENERIC, "object id out of range (%d %d R)", num, gen);
- x = pdf_get_xref_entry(doc, num);
-
pdf_cache_object(doc, num, gen);
+ x = pdf_get_xref_entry(doc, num);
if (x->stm_ofs == 0)
fz_throw(doc->ctx, FZ_ERROR_GENERIC, "object is not a stream");
@@ -383,10 +382,9 @@ pdf_open_image_stream(pdf_document *doc, int num, int gen, int orig_num, int ori
if (num < 0 || num >= pdf_xref_len(doc))
fz_throw(doc->ctx, FZ_ERROR_GENERIC, "object id out of range (%d %d R)", num, gen);
- x = pdf_get_xref_entry(doc, num);
-
pdf_cache_object(doc, num, gen);
+ x = pdf_get_xref_entry(doc, num);
if (x->stm_ofs == 0 && x->stm_buf == NULL)
fz_throw(doc->ctx, FZ_ERROR_GENERIC, "object is not a stream");