1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 01:52:19 +00:00

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

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