changeset 32615:1bede0ded07e

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.
author reimar
date Sun, 12 Dec 2010 11:45:47 +0000
parents 4558e2b7e68b
children f023e5d1a0fd
files stream/stream.h
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream.h	Sun Dec 12 10:37:15 2010 +0000
+++ b/stream/stream.h	Sun Dec 12 11:45:47 2010 +0000
@@ -292,6 +292,10 @@
 
   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){