summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pdf/pdf_errors.h1
-rw-r--r--pdf/pdf_xref.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/pdf/pdf_errors.h b/pdf/pdf_errors.h
index 9bd0741cb..e2f17f247 100644
--- a/pdf/pdf_errors.h
+++ b/pdf/pdf_errors.h
@@ -71,4 +71,5 @@ PARAM(E_PDF_DICT_IS_STREAM, "Expected a dictionary but encountered a
PARAM(E_PDF_BAD_TYPE, "An object is of the wrong type"),
PARAM(E_PDF_BAD_VALUE, "An object has an unexpected value"),
PARAM(E_PDF_BAD_ANNOTATION, "There was an error in an annotation"),
+PARAM(E_PDF_BAD_XREFSTMOFFSET, "An XRefStm value did not point to a cross reference stream"),
#undef PARAM
diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c
index 3ec5a144e..0f95bfbf0 100644
--- a/pdf/pdf_xref.c
+++ b/pdf/pdf_xref.c
@@ -436,6 +436,7 @@ static int pdfi_read_xref_stream_dict(pdf_context *ctx, pdf_c_stream *s, int obj
/* Third element must be obj, or it's not a valid xref */
if (code != TOKEN_OBJ) {
+ pdfi_set_error(ctx, 0, NULL, E_PDF_BAD_XREFSTMOFFSET, "pdfi_read_xref_stream_dict", "");
if (ctx->args.pdfstoponerror)
return code;
return(pdfi_repair_file(ctx));
@@ -850,7 +851,7 @@ static int read_xref(pdf_context *ctx, pdf_c_stream *s)
if (code < 0)
goto error;
- if (max_obj > num)
+ if (max_obj >= num)
pdfi_set_warning(ctx, 0, NULL, W_PDF_BAD_XREF_SIZE, "read_xref", NULL);
/* Check if this is a modified file and has any