Bug 703205: Don't freak out about invalid indirect references.
authorTor Andersson <[email protected]>
Fri, 15 Jan 2021 16:48:02 +0000 (17:48 +0100)
committerFred Ross-Perry <[email protected]>
Tue, 26 Jan 2021 17:40:10 +0000 (09:40 -0800)
Print a warning and turn them into 'null' so we don't throw away the
whole dictionary being parsed.

source/pdf/pdf-object.c

index c684fec44e1f15a93674f3e922a06dab6262874f..a6ec39e72ead3f30eaef5ac5600b9d38da66f464 100644 (file)
@@ -180,9 +180,15 @@ pdf_new_indirect(fz_context *ctx, pdf_document *doc, int num, int gen)
 {
        pdf_obj_ref *obj;
        if (num < 0 || num > PDF_MAX_OBJECT_NUMBER)
-               fz_throw(ctx, FZ_ERROR_SYNTAX, "invalid object number (%d)", num);
+       {
+               fz_warn(ctx, "invalid object number (%d)", num);
+               return PDF_NULL;
+       }
        if (gen < 0 || gen > PDF_MAX_GEN_NUMBER)
-               fz_throw(ctx, FZ_ERROR_SYNTAX, "invalid generation number (%d)", gen);
+       {
+               fz_warn(ctx, "invalid generation number (%d)", gen);
+               return PDF_NULL;
+       }
        obj = Memento_label(fz_malloc(ctx, sizeof(pdf_obj_ref)), "pdf_obj(indirect)");
        obj->super.refs = 1;
        obj->super.kind = PDF_INDIRECT;