summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-repair.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-12-11 14:09:15 +0100
committerSebastian Rasmussen <sebras@gmail.com>2017-12-13 21:38:26 +0100
commit55c3f68d638ac1263a386e0aaa004bb6e8bde731 (patch)
tree27fd12c9cea4acc2718674b47cda3c029c490e11 /source/pdf/pdf-repair.c
parentc7a470081787cb85e6997dd611f24bfb280d55c2 (diff)
downloadmupdf-55c3f68d638ac1263a386e0aaa004bb6e8bde731.tar.xz
Bugs 698804/698810/698811: Keep PDF object numbers below limit.
This ensures that: * xref tables with objects pointers do not grow out of bounds. * other readers, e.g. Adobe Acrobat can parse PDFs written by mupdf.
Diffstat (limited to 'source/pdf/pdf-repair.c')
-rw-r--r--source/pdf/pdf-repair.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/source/pdf/pdf-repair.c b/source/pdf/pdf-repair.c
index ca149bd3..0c29758e 100644
--- a/source/pdf/pdf-repair.c
+++ b/source/pdf/pdf-repair.c
@@ -6,9 +6,6 @@
/* Scan file for objects and reconstruct xref table */
-/* Define in PDF 1.7 to be 8388607, but mupdf is more lenient. */
-#define MAX_OBJECT_NUMBER (10 << 20)
-
struct entry
{
int num;
@@ -436,7 +433,7 @@ pdf_repair_xref(fz_context *ctx, pdf_document *doc)
break;
}
- if (num <= 0 || num > MAX_OBJECT_NUMBER)
+ if (num <= 0 || num > PDF_MAX_OBJECT_NUMBER)
{
fz_warn(ctx, "ignoring object with invalid object number (%d %d R)", num, gen);
goto have_next_token;