summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_viv.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_viv.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_viv.c')
-rw-r--r--libmpdemux/demux_viv.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libmpdemux/demux_viv.c b/libmpdemux/demux_viv.c
index cc8823017d..910a724225 100644
--- a/libmpdemux/demux_viv.c
+++ b/libmpdemux/demux_viv.c
@@ -15,6 +15,12 @@
#include "stheader.h"
#include "bswap.h"
+#ifdef USE_LIBAVCODEC
+#include "avcodec.h"
+#else
+#define FF_INPUT_BUFFER_PADDING_SIZE 8
+#endif
+
/* parameters ! */
int vivo_param_version = -1;
char *vivo_param_acodec = NULL;
@@ -379,7 +385,8 @@ static int demux_vivo_fill_buffer(demuxer_t *demux, demux_stream_t *dsds){
} else {
// append data to it!
demux_packet_t* dp=ds->asf_packet;
- dp->buffer=realloc(dp->buffer,dp->len+len);
+ dp->buffer=realloc(dp->buffer,dp->len+len+FF_INPUT_BUFFER_PADDING_SIZE);
+ memset(dp->buffer+dp->len+len, 0, FF_INPUT_BUFFER_PADDING_SIZE);
//memcpy(dp->buffer+dp->len,data,len);
stream_read(demux->stream,dp->buffer+dp->len,len);
mp_dbg(MSGT_DEMUX,MSGL_DBG4,"data appended! %d+%d\n",dp->len,len);