aboutsummaryrefslogtreecommitdiffstats
path: root/src/pdf_parser.c
diff options
context:
space:
mode:
authoryzrh <yzrh@noema.org>2020-12-30 17:06:55 +0000
committeryzrh <yzrh@noema.org>2020-12-30 21:12:52 +0000
commit1f62c53da6edc5a82a1e0eceb401b2274cd4a0d1 (patch)
tree24359d29576a26ae70c446d4d01a8a93a61d62c2 /src/pdf_parser.c
parent98691d4203f4e578b84b2014db0fbe0c1209cc48 (diff)
downloadmelon-1f62c53da6edc5a82a1e0eceb401b2274cd4a0d1.tar.gz
melon-1f62c53da6edc5a82a1e0eceb401b2274cd4a0d1.tar.zst
Produce PDF directly from KDH.
Diffstat (limited to 'src/pdf_parser.c')
-rw-r--r--src/pdf_parser.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/pdf_parser.c b/src/pdf_parser.c
index 9c361a2..9531d28 100644
--- a/src/pdf_parser.c
+++ b/src/pdf_parser.c
@@ -154,10 +154,16 @@ pdf_load(pdf_object_t **pdf, FILE **fp, int size_buf)
if ((head = memmem(buf, ptr->size, "<<", 2)) != NULL &&
(tail = _memmem_whitespace(buf, ptr->size, ">>", 2)) != NULL) {
- /* A dictionary object may have nested dictionary */
+ /*
+ * A dictionary object may have nested dictionary,
+ * but it should not be in a stream
+ */
while ((tmp = _memmem_whitespace(tail + 2,
ptr->size - (tail - buf) - 2,
- ">>", 2)) != NULL)
+ ">>", 2)) != NULL &&
+ memmem(tail + 2,
+ ptr->size - (tail - buf) - 2,
+ "stream\r\n", 8) == NULL)
tail = tmp;
ptr->dictionary_size = tail - head + 2;