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:
reimar 2010-12-12 11:45:47 +00:00 committed by Uoti Urpala
parent 7ed3291a4f
commit eb5765e96a
1 changed files with 4 additions and 0 deletions

View File

@ -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){