changeset 5005:53092c7684a2 libavformat

Ensure that the extradata buffer is padded appripriately in the ogg demuxer. Spotted by valgrind.
author conrad
date Fri, 05 Jun 2009 23:39:11 +0000
parents 84a7b7a2f252
children 686de8748c36
files oggparsespeex.c oggparsetheora.c
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/oggparsespeex.c	Thu Jun 04 06:25:53 2009 +0000
+++ b/oggparsespeex.c	Fri Jun 05 23:39:11 2009 +0000
@@ -47,7 +47,8 @@
         st->codec->channels = AV_RL32(p + 48);
         st->codec->frame_size = AV_RL32(p + 56);
         st->codec->extradata_size = os->psize;
-        st->codec->extradata = av_malloc(st->codec->extradata_size);
+        st->codec->extradata = av_malloc(st->codec->extradata_size
+                                         + FF_INPUT_BUFFER_PADDING_SIZE);
         memcpy(st->codec->extradata, p, st->codec->extradata_size);
 
         st->time_base.num = 1;
--- a/oggparsetheora.c	Thu Jun 04 06:25:53 2009 +0000
+++ b/oggparsetheora.c	Fri Jun 05 23:39:11 2009 +0000
@@ -106,7 +106,8 @@
         vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8);
     }
 
-    st->codec->extradata = av_realloc (st->codec->extradata, cds);
+    st->codec->extradata = av_realloc (st->codec->extradata,
+                                       cds + FF_INPUT_BUFFER_PADDING_SIZE);
     cdp = st->codec->extradata + st->codec->extradata_size;
     *cdp++ = os->psize >> 8;
     *cdp++ = os->psize & 0xff;