diff options
Diffstat (limited to 'src/pdf_parser.c')
-rw-r--r-- | src/pdf_parser.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pdf_parser.c b/src/pdf_parser.c index 70d72d5..6520fd5 100644 --- a/src/pdf_parser.c +++ b/src/pdf_parser.c @@ -232,7 +232,8 @@ pdf_load(pdf_object_t **pdf, FILE **fp, int size_buf) * A dictionary object may have nested dictionary, * but it should not be in a stream */ - while ((tmp = _memmem_whitespace(tail + 3, + while (ptr->size - (tail - buf) > 3 && + (tmp = _memmem_whitespace(tail + 3, ptr->size - (tail - buf) - 3, ">>", 2)) != NULL && memmem(tail + 3, @@ -241,7 +242,8 @@ pdf_load(pdf_object_t **pdf, FILE **fp, int size_buf) tail = tmp; /* Hack needed for invalid object */ - while ((tmp = memmem(tail + 2, + while (ptr->size - (tail - buf) > 2 && + (tmp = memmem(tail + 2, ptr->size - (tail - buf) - 2, ">>", 2)) != NULL && memmem(tail + 2, |