From 7ac0971a1711233bc0eaa5e8191590612959867b Mon Sep 17 00:00:00 2001 From: yzrh Date: Tue, 3 Jan 2023 15:39:53 +0000 Subject: Handle invalid result from PDF parser. Signed-off-by: yzrh --- src/pdf_parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/pdf_parser.c') diff --git a/src/pdf_parser.c b/src/pdf_parser.c index 2585e6f..781bafa 100644 --- a/src/pdf_parser.c +++ b/src/pdf_parser.c @@ -119,7 +119,8 @@ _locate(pdf_object_t **pdf, FILE **fp, int size_buf) fseek(*fp, tail + 7, SEEK_SET); head = tail = 0; } else if (head > 0 && tail > 0) { - fseek(*fp, head, SEEK_SET); + if (cur + size_buf < end) + fseek(*fp, head, SEEK_SET); tail = 0; } else { fseek(*fp, -7, SEEK_CUR); -- cgit v1.2.3