From 1f62c53da6edc5a82a1e0eceb401b2274cd4a0d1 Mon Sep 17 00:00:00 2001 From: yzrh Date: Wed, 30 Dec 2020 17:06:55 +0000 Subject: Produce PDF directly from KDH. --- src/pdf_parser.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/pdf_parser.c') 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; -- cgit v1.2.3