Fix to make pdf_mark_list_push balance with pdf_mark_list_pop...
authorTor Andersson <[email protected]>
Tue, 3 May 2022 14:43:47 +0000 (16:43 +0200)
committerTor Andersson <[email protected]>
Tue, 3 May 2022 14:46:18 +0000 (16:46 +0200)
...even when pushing a non-indirect object.

source/pdf/pdf-object.c

index 9919d0e146ee1056f3d549b723c3b0b9f1507221..5873d244a7cc82588ea62af33b7d4e82fd81a230 100644 (file)
@@ -2479,13 +2479,13 @@ pdf_mark_list_push(fz_context *ctx, pdf_mark_list *marks, pdf_obj *obj)
        int num = pdf_to_num(ctx, obj);
        int i;
 
-       if (num == 0)
-               return 0;
-
-       /* Note: this is slow, if the mark list is expected to be big use pdf_mark_bits instead! */
-       for (i = 0; i < marks->len; ++i)
-               if (marks->list[i] == num)
-                       return 1;
+       if (num > 0)
+       {
+               /* Note: this is slow, if the mark list is expected to be big use pdf_mark_bits instead! */
+               for (i = 0; i < marks->len; ++i)
+                       if (marks->list[i] == num)
+                               return 1;
+       }
 
        if (marks->len == marks->max)
        {