cache: cache-position needs to be int64_t

Both max_filepos and offset are int64_t,
so pos can overflow, e.g. causing endless loops
in stream implementation.
This commit is contained in:
Oliver Freyermuth 2015-01-13 00:54:03 +01:00 committed by wm4
parent 3d1b9ba4bd
commit 794804725d
1 changed files with 1 additions and 1 deletions

View File

@ -241,7 +241,7 @@ static bool cache_fill(struct priv *s)
int64_t space = s->buffer_size - (newb + back);
// offset into the buffer that maps to max_filepos
int pos = s->max_filepos - s->offset;
int64_t pos = s->max_filepos - s->offset;
if (pos >= s->buffer_size)
pos -= s->buffer_size; // wrap-around