summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/pdf/pdf-parse.c2
-rw-r--r--source/pdf/pdf-xref.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/source/pdf/pdf-parse.c b/source/pdf/pdf-parse.c
index 7904ebd7d..b4783ae8f 100644
--- a/source/pdf/pdf-parse.c
+++ b/source/pdf/pdf-parse.c
@@ -623,6 +623,8 @@ pdf_parse_ind_obj(fz_context *ctx, pdf_document *doc,
623 fz_throw(ctx, FZ_ERROR_SYNTAX, "expected object number"); 623 fz_throw(ctx, FZ_ERROR_SYNTAX, "expected object number");
624 } 624 }
625 num = buf->i; 625 num = buf->i;
626 if (num < 0 || num > PDF_MAX_OBJECT_NUMBER)
627 fz_throw(ctx, FZ_ERROR_SYNTAX, "object number out of range");
626 628
627 tok = pdf_lex(ctx, file, buf); 629 tok = pdf_lex(ctx, file, buf);
628 if (tok != PDF_TOK_INT) 630 if (tok != PDF_TOK_INT)
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index 4997ebe54..cfcd0a21c 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -228,8 +228,8 @@ pdf_xref_entry *pdf_get_populating_xref_entry(fz_context *ctx, pdf_document *doc
228 } 228 }
229 229
230 /* Prevent accidental heap underflow */ 230 /* Prevent accidental heap underflow */
231 if (num < 0) 231 if (num < 0 || num > PDF_MAX_OBJECT_NUMBER)
232 fz_throw(ctx, FZ_ERROR_GENERIC, "object number must not be negative (%d)", num); 232 fz_throw(ctx, FZ_ERROR_GENERIC, "object number out of range (%d)", num);
233 233
234 /* Return the pointer to the entry in the last section. */ 234 /* Return the pointer to the entry in the last section. */
235 xref = &doc->xref_sections[doc->num_xref_sections-1]; 235 xref = &doc->xref_sections[doc->num_xref_sections-1];