aboutsummaryrefslogtreecommitdiffstats
path: root/src/pdf_parser.c
diff options
context:
space:
mode:
authoryzrh <yzrh@noema.org>2023-01-03 15:39:53 +0000
committeryzrh <yzrh@noema.org>2023-01-03 15:39:53 +0000
commit7ac0971a1711233bc0eaa5e8191590612959867b (patch)
tree955a3c2d9fc4c32e4b972b558878a2d439c61b93 /src/pdf_parser.c
parente0fe937e1a3c61581f80e27ad5d2c510e0901755 (diff)
downloadmelon-7ac0971a1711233bc0eaa5e8191590612959867b.tar.gz
melon-7ac0971a1711233bc0eaa5e8191590612959867b.tar.zst
Handle invalid result from PDF parser.
Signed-off-by: yzrh <yzrh@noema.org>
Diffstat (limited to 'src/pdf_parser.c')
-rw-r--r--src/pdf_parser.c3
1 files changed, 2 insertions, 1 deletions
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);