summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_real.c
diff options
context:
space:
mode:
authorhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-12-19 19:38:28 +0000
committerhenry <henry@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-12-19 19:38:28 +0000
commitc0e54fd248d11f41ac44756b34b47d2054d82465 (patch)
tree83ea5587981cda6ab1654d6272807d8c6e82c06f /libmpdemux/demux_real.c
parent335f35f2bf4d6fbc7caa9a27e8f8d21f4c937477 (diff)
downloadmpv-c0e54fd248d11f41ac44756b34b47d2054d82465.tar.bz2
mpv-c0e54fd248d11f41ac44756b34b47d2054d82465.tar.xz
malloc padding to avoid access beyond allocated memory
Credits to Mikulas Patocka (mikulas at artax karlin mff cuni cz) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17227 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demux_real.c')
-rw-r--r--libmpdemux/demux_real.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libmpdemux/demux_real.c b/libmpdemux/demux_real.c
index 0d6ce85a75..5348c06b19 100644
--- a/libmpdemux/demux_real.c
+++ b/libmpdemux/demux_real.c
@@ -32,6 +32,12 @@ Video codecs: (supported by RealPlayer8 for Linux)
#include "stheader.h"
#include "bswap.h"
+#ifdef USE_LIBAVCODEC
+#include "avcodec.h"
+#else
+#define FF_INPUT_BUFFER_PADDING_SIZE 8
+#endif
+
//#define mp_dbg(mod,lev, args... ) mp_msg_c((mod<<8)|lev, ## args )
#define MKTAG(a, b, c, d) (a | (b << 8) | (c << 16) | (d << 24))
@@ -921,7 +927,8 @@ got_video:
// increase buffer size, this should not happen!
mp_msg(MSGT_DEMUX,MSGL_WARN, "chunktab buffer too small!!!!!\n");
dp->len=dp_hdr->chunktab+8*(4+dp_hdr->chunks);
- dp->buffer=realloc(dp->buffer,dp->len);
+ dp->buffer=realloc(dp->buffer,dp->len+FF_INPUT_BUFFER_PADDING_SIZE);
+ memset(dp->buffer + dp->len, 0, FF_INPUT_BUFFER_PADDING_SIZE);
// re-calc pointers:
dp_hdr=(dp_hdr_t*)dp->buffer;
dp_data=dp->buffer+sizeof(dp_hdr_t);