Commit fbde21d9 authored by michael's avatar michael

allocate a few bytes more for extradata so the bitstream reader if its used by...

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


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@3679 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 25c890f9
......@@ -274,7 +274,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
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);
}
......
......@@ -301,7 +301,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
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
......
......@@ -569,7 +569,7 @@ static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
#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 @@ static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
// 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
......
......@@ -982,7 +982,7 @@ static int decode_stream_header(NUTContext *nut){
/* 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));
}
......
......@@ -196,7 +196,7 @@ static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap)
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;
......
......@@ -211,7 +211,7 @@ static void sdp_parse_fmtp(AVCodecContext *codec, const char *p)
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;
......
......@@ -154,7 +154,7 @@ void get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment