mirror of
https://github.com/mpv-player/mpv
synced 2024-10-02 16:25:33 +02:00
stream.h: check against huge negative values in stream_seek()
Add validity check for stream_seek argument to avoid a integer overflow for huge negative values that would break the internal state of the stream buffer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32702 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
7ed3291a4f
commit
eb5765e96a
@ -295,6 +295,10 @@ inline static int stream_seek(stream_t *s,off_t pos){
|
||||
|
||||
mp_dbg(MSGT_DEMUX, MSGL_DBG3, "seek to 0x%qX\n",(long long)pos);
|
||||
|
||||
if (pos < 0) {
|
||||
mp_msg(MSGT_DEMUX, MSGL_ERR, "Invalid seek to negative position!\n");
|
||||
pos = 0;
|
||||
}
|
||||
if(pos<s->pos){
|
||||
off_t x=pos-(s->pos-s->buf_len);
|
||||
if(x>=0){
|
||||
|
Loading…
Reference in New Issue
Block a user