summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-12-12 11:45:47 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-12-16 06:22:19 +0200
commiteb5765e96a70b19ff75f9ee18c988346b4fc48c1 (patch)
tree8d014d066438fe19058b183ee215c38e2a0eabea
parent7ed3291a4fc98fa0cb8a2d3ad777ffc317ba0c21 (diff)
downloadmpv-eb5765e96a70b19ff75f9ee18c988346b4fc48c1.tar.bz2
mpv-eb5765e96a70b19ff75f9ee18c988346b4fc48c1.tar.xz
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
-rw-r--r--stream/stream.h4
1 files changed, 4 insertions, 0 deletions
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(pos<s->pos){
off_t x=pos-(s->pos-s->buf_len);
if(x>=0){