summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
Diffstat (limited to 'fitz')
-rw-r--r--fitz/stm_read.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fitz/stm_read.c b/fitz/stm_read.c
index 4a81b9cd..59f06433 100644
--- a/fitz/stm_read.c
+++ b/fitz/stm_read.c
@@ -173,6 +173,16 @@ fz_seek(fz_stream *stm, int offset, int whence)
offset = fz_tell(stm) + offset;
whence = 0;
}
+ if (whence == 0)
+ {
+ unsigned char *p = stm->wp - (stm->pos - offset);
+ if (p >= stm->bp && p <= stm->wp)
+ {
+ stm->rp = p;
+ stm->eof = 0;
+ return;
+ }
+ }
stm->seek(stm, offset, whence);
stm->eof = 0;
}