diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-09-23 17:46:53 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-09-24 12:03:31 +0100 |
commit | 6a0253dab60fb9e94e5d9a21826cf1bc6e83e03a (patch) | |
tree | f112f3ee320f158c34eebff34bec435fe42cccd0 | |
parent | ac0a31f6fc71e07f67a43cd1fe5004def4c955a6 (diff) | |
download | mupdf-6a0253dab60fb9e94e5d9a21826cf1bc6e83e03a.tar.xz |
Bug 694566: Avoid locking up while seeking in deflated stream.
In streams that we cannot seek in (such as flate ones) we implement
seeking forward by skipping bytes. We failed to spot that we hit EOF,
and spent ages just looping. Fix is simply to spot that we hit EOF
and bale with a warning.
-rw-r--r-- | source/fitz/stream-read.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/fitz/stream-read.c b/source/fitz/stream-read.c index d433ce32..71ae7666 100644 --- a/source/fitz/stream-read.c +++ b/source/fitz/stream-read.c @@ -217,7 +217,13 @@ fz_seek(fz_stream *stm, int offset, int whence) fz_warn(stm->ctx, "cannot seek backwards"); /* dog slow, but rare enough */ while (offset-- > 0) - fz_read_byte(stm); + { + if (fz_read_byte(stm) == EOF) + { + fz_warn(stm->ctx, "seek failed"); + break; + } + } } else fz_warn(stm->ctx, "cannot seek"); |