aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGE.md3
-rw-r--r--src/cnki_pdf.c9
2 files changed, 7 insertions, 5 deletions
diff --git a/CHANGE.md b/CHANGE.md
index a832777..63a76c3 100644
--- a/CHANGE.md
+++ b/CHANGE.md
@@ -1,10 +1,11 @@
0.3.0 (2023-XX-XX)
==================
-* Handle missing but referenced root object.
* Support JPEG 2000 for HN.
* Support HN figure placement.
* Support HN text overlay.
+* Handle missing but referenced root object.
+* Fix buffer overflow.
0.2.1 (2022-12-26)
==================
diff --git a/src/cnki_pdf.c b/src/cnki_pdf.c
index 502a0ce..328a989 100644
--- a/src/cnki_pdf.c
+++ b/src/cnki_pdf.c
@@ -322,12 +322,13 @@ cnki_pdf(cnki_t **param)
root = i;
}
- if ((*param)->stat > 0)
- printf("Root object is %d.\n",
- root);
+ if (root == 0)
+ root = pdf_get_free_id(&pdf);
+ 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)
printf("Root object is missing\n");