diff options
author | Sebastian Rasmussen <sebras@hotmail.com> | 2009-08-23 16:17:58 +0200 |
---|---|---|
committer | Sebastian Rasmussen <sebras@hotmail.com> | 2009-08-23 16:17:58 +0200 |
commit | 3d4ab58c8b8812be0304301df7c53020d20b8fa7 (patch) | |
tree | 93ee2f8c57f495a4db67a4ca05fa98c18e31ef8e /fitz | |
parent | da98a190ab57f00268e3ebd11df20aa68bad2dd4 (diff) | |
download | mupdf-3d4ab58c8b8812be0304301df7c53020d20b8fa7.tar.xz |
Make sure output buffer is not full when filling it and detect end of input buffer properly.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/stm_misc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fitz/stm_misc.c b/fitz/stm_misc.c index a95833b4..8e3ced42 100644 --- a/fitz/stm_misc.c +++ b/fitz/stm_misc.c @@ -46,7 +46,7 @@ static inline int fz_fillbuf(fz_stream *stm, fz_buffer *buf) int remaining = buf->ep - buf->wp; int available = stm->buffer->wp - stm->buffer->rp; - if (available == 0) + if (available == 0 && remaining > 0) { int c = fz_readbytex(stm); if (c == EOF) @@ -62,7 +62,7 @@ static inline int fz_fillbuf(fz_stream *stm, fz_buffer *buf) buf->wp += MIN(remaining, available); stm->buffer->rp += MIN(remaining, available); - if (buf->rp == buf->wp && stm->buffer->eof) + if (stm->buffer->rp == stm->buffer->wp && stm->buffer->eof) return EOF; return 0; } |