summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-stream.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2014-06-09 14:02:16 +0200
committerTor Andersson <tor.andersson@artifex.com>2014-06-09 16:23:11 +0200
commita6f0d56d2d2e66cef2b4ca6e810bf3630ed53d0b (patch)
tree1bfc678529b37d58643da6138f0e51a1bb40c6d1 /source/pdf/pdf-stream.c
parent0f0653cac62c7dbcd4b4cd2ea57640769271365c (diff)
downloadmupdf-a6f0d56d2d2e66cef2b4ca6e810bf3630ed53d0b.tar.xz
Fix 695300: don't throw exception on invalid reference number.
Return the null object rather than throwing an exception when parsing indirect object references with negative object numbers. Do range check for object numbers (1 .. length) when object numbers are used instead. Object number 0 is not a valid object number. It must always be 'free'.
Diffstat (limited to 'source/pdf/pdf-stream.c')
-rw-r--r--source/pdf/pdf-stream.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/pdf/pdf-stream.c b/source/pdf/pdf-stream.c
index 54cf87fe..930c30cb 100644
--- a/source/pdf/pdf-stream.c
+++ b/source/pdf/pdf-stream.c
@@ -8,7 +8,7 @@ pdf_is_stream(pdf_document *doc, int num, int gen)
{
pdf_xref_entry *entry;
- if (num < 0 || num >= pdf_xref_len(doc))
+ if (num <= 0 || num >= pdf_xref_len(doc))
return 0;
pdf_cache_object(doc, num, gen);
@@ -405,7 +405,7 @@ pdf_open_raw_renumbered_stream(pdf_document *doc, int num, int gen, int orig_num
{
pdf_xref_entry *x;
- if (num < 0 || num >= pdf_xref_len(doc))
+ 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);
pdf_cache_object(doc, num, gen);
@@ -422,7 +422,7 @@ pdf_open_image_stream(pdf_document *doc, int num, int gen, int orig_num, int ori
{
pdf_xref_entry *x;
- if (num < 0 || num >= pdf_xref_len(doc))
+ 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);
pdf_cache_object(doc, num, gen);