changeset 587:fe24632a577b libavformat

allocate a few bytes more for extradata so the bitstream reader if its used by the codec for parsing extardata, doesnt read over the end
author michael
date Sat, 13 Nov 2004 01:27:35 +0000
parents d31051b85c3d
children 113101b95d3b
files asf.c avidec.c mov.c nut.c ogg.c rtsp.c wav.c
diffstat 7 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/asf.c	Fri Nov 12 22:51:52 2004 +0000
+++ b/asf.c	Sat Nov 13 01:27:35 2004 +0000
@@ -274,7 +274,7 @@
 		url_fskip(pb, 20);
 		if (size > 40) {
 		    st->codec.extradata_size = size - 40;
-		    st->codec.extradata = av_mallocz(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);
 		}
 
--- a/avidec.c	Fri Nov 12 22:51:52 2004 +0000
+++ b/avidec.c	Sat Nov 13 01:27:35 2004 +0000
@@ -301,7 +301,7 @@
                     get_le32(pb); /* ClrImportant */
 
                     st->codec.extradata_size= size - 10*4;
-                    st->codec.extradata= av_malloc(st->codec.extradata_size);
+                    st->codec.extradata= av_malloc(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
                     get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
                     
                     if(st->codec.extradata_size & 1) //FIXME check if the encoder really did this correctly
--- a/mov.c	Fri Nov 12 22:51:52 2004 +0000
+++ b/mov.c	Sat Nov 13 01:27:35 2004 +0000
@@ -569,7 +569,7 @@
 #ifdef DEBUG
 	    av_log(NULL, AV_LOG_DEBUG, "Specific MPEG4 header len=%d\n", len);
 #endif
-	    st->codec.extradata = (uint8_t*) av_mallocz(len);
+	    st->codec.extradata = (uint8_t*) av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
 	    if (st->codec.extradata) {
 		get_buffer(pb, st->codec.extradata, len);
 		st->codec.extradata_size = len;
@@ -680,7 +680,7 @@
     // this should be fixed and just SMI header should be passed
     av_free(st->codec.extradata);
     st->codec.extradata_size = 0x5a + atom.size;
-    st->codec.extradata = (uint8_t*) av_mallocz(st->codec.extradata_size);
+    st->codec.extradata = (uint8_t*) av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
 
     if (st->codec.extradata) {
 	strcpy(st->codec.extradata, "SVQ3"); // fake
--- a/nut.c	Fri Nov 12 22:51:52 2004 +0000
+++ b/nut.c	Sat Nov 13 01:27:35 2004 +0000
@@ -982,7 +982,7 @@
     /* codec specific data headers */
     while(get_v(bc) != 0){
         st->codec.extradata_size= get_v(bc);
-        st->codec.extradata= av_mallocz(st->codec.extradata_size);
+        st->codec.extradata= av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
         get_buffer(bc, st->codec.extradata, st->codec.extradata_size);            
 //	    url_fskip(bc, get_v(bc));
     }
--- a/ogg.c	Fri Nov 12 22:51:52 2004 +0000
+++ b/ogg.c	Sat Nov 13 01:27:35 2004 +0000
@@ -196,7 +196,7 @@
             return -1;
         }
         codec->extradata_size+= 2 + op.bytes;
-        codec->extradata= av_realloc(codec->extradata, codec->extradata_size);
+        codec->extradata= av_realloc(codec->extradata, codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
         p= codec->extradata + codec->extradata_size - 2 - op.bytes;
         *(p++)= op.bytes>>8;
         *(p++)= op.bytes&0xFF;
--- a/rtsp.c	Fri Nov 12 22:51:52 2004 +0000
+++ b/rtsp.c	Sat Nov 13 01:27:35 2004 +0000
@@ -211,7 +211,7 @@
             if (!strcmp(attr, "config")) {
                 /* decode the hexa encoded parameter */
                 len = hex_to_data(NULL, value);
-                codec->extradata = av_mallocz(len);
+                codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
                 if (!codec->extradata)
                     goto fail;
                 codec->extradata_size = len;
--- a/wav.c	Fri Nov 12 22:51:52 2004 +0000
+++ b/wav.c	Sat Nov 13 01:27:35 2004 +0000
@@ -154,7 +154,7 @@
 	if (codec->extradata_size > 0) {
 	    if (codec->extradata_size > size - 18)
 	        codec->extradata_size = size - 18;
-            codec->extradata = av_mallocz(codec->extradata_size);
+            codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
             get_buffer(pb, codec->extradata, codec->extradata_size);
         } else
 	    codec->extradata_size = 0;