aboutsummaryrefslogtreecommitdiffstats
path: root/src/pdf_parser.c
diff options
context:
space:
mode:
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);