Fix PDF object check.

Signed-off-by: yzrh <yzrh@noema.org>
This commit is contained in:
yzrh 2022-12-29 05:23:04 +00:00
parent cd0af5ba3c
commit 97931e1470
2 changed files with 7 additions and 5 deletions

View file

@ -1,10 +1,11 @@
0.3.0 (2023-XX-XX) 0.3.0 (2023-XX-XX)
================== ==================
* Handle missing but referenced root object.
* Support JPEG 2000 for HN. * Support JPEG 2000 for HN.
* Support HN figure placement. * Support HN figure placement.
* Support HN text overlay. * Support HN text overlay.
* Handle missing but referenced root object.
* Fix buffer overflow.
0.2.1 (2022-12-26) 0.2.1 (2022-12-26)
================== ==================

View file

@ -322,12 +322,13 @@ cnki_pdf(cnki_t **param)
root = i; root = i;
} }
if ((*param)->stat > 0) if (root == 0)
printf("Root object is %d.\n", root = pdf_get_free_id(&pdf);
root); else if ((*param)->stat > 0)
printf("Root object is %d.\n", root);
} }
if (pdf_get_kid_count(&pdf, root) == 0) { if (pdf_get_obj(&pdf, root, NULL) != 0) {
if ((*param)->stat > 0) if ((*param)->stat > 0)
printf("Root object is missing\n"); printf("Root object is missing\n");