From eb5765e96a70b19ff75f9ee18c988346b4fc48c1 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 12 Dec 2010 11:45:47 +0000 Subject: 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 --- stream/stream.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'stream') diff --git a/stream/stream.h b/stream/stream.h index 021296b247..cad61d3256 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -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(pospos){ off_t x=pos-(s->pos-s->buf_len); if(x>=0){ -- cgit v1.2.3