summaryrefslogtreecommitdiff
path: root/libavformat/rm.c
diff options
context:
space:
mode:
authorJindřich Makovička <makovick@gmail.com>2005-12-17 17:57:03 +0000
committerJindřich Makovička <makovick@gmail.com>2005-12-17 17:57:03 +0000
commitd76319b1ab716320f6e6a4d690b85fe4504ebd5b (patch)
tree60e46ea97983711974a83c54752d0795c9707928 /libavformat/rm.c
parent63d33cf4390a9280b1ba42ee722f3140cf1cad3e (diff)
malloc padding to avoid reading past the malloc()ed area.
Credits to Mikulas Patocka (mikulas at artax karlin mff cuni cz) Originally committed as revision 4748 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rm.c')
-rw-r--r--libavformat/rm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/rm.c b/libavformat/rm.c
index b8ef354353..5433da73a1 100644
--- a/libavformat/rm.c
+++ b/libavformat/rm.c
@@ -557,7 +557,7 @@ static void rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
codecdata_length = get_be32(pb);
st->codec->codec_id = CODEC_ID_COOK;
st->codec->extradata_size= codecdata_length;
- st->codec->extradata= av_mallocz(st->codec->extradata_size);
+ st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
for(i = 0; i < codecdata_length; i++)
((uint8_t*)st->codec->extradata)[i] = get_byte(pb);
rm->audio_framesize = st->codec->block_align;
@@ -708,7 +708,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
get_be16(pb);
st->codec->extradata_size= codec_data_size - (url_ftell(pb) - codec_pos);
- st->codec->extradata= av_malloc(st->codec->extradata_size);
+ st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
// av_log(NULL, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2);