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-25 17:00:09 +09:00
committed by Diogo Franco (Kovensky)
parent 6d7eb8346a
commit 4bb2da8204
+1 -1
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