Mercurial > libavformat.hg
comparison utils.c @ 2417:70b45051aef6 libavformat
fix probe buffer issue. patch by Wolfram Gloger {wmglo at dent.med.uni-muenchen.de}.
[FFmpeg-devel] [PATCH] ac3_probe input buffer overrun
Aug 28, 2007
author | jbr |
---|---|
date | Mon, 03 Sep 2007 05:19:59 +0000 |
parents | c356a88cedf6 |
children | b08793768c30 |
comparison
equal
deleted
inserted
replaced
2416:1a2f353ac291 | 2417:70b45051aef6 |
---|---|
443 for(probe_size= PROBE_BUF_MIN; probe_size<=PROBE_BUF_MAX && !fmt; probe_size<<=1){ | 443 for(probe_size= PROBE_BUF_MIN; probe_size<=PROBE_BUF_MAX && !fmt; probe_size<<=1){ |
444 int score= probe_size < PROBE_BUF_MAX ? AVPROBE_SCORE_MAX/4 : 0; | 444 int score= probe_size < PROBE_BUF_MAX ? AVPROBE_SCORE_MAX/4 : 0; |
445 /* read probe data */ | 445 /* read probe data */ |
446 pd->buf= av_realloc(pd->buf, probe_size + AVPROBE_PADDING_SIZE); | 446 pd->buf= av_realloc(pd->buf, probe_size + AVPROBE_PADDING_SIZE); |
447 pd->buf_size = get_buffer(pb, pd->buf, probe_size); | 447 pd->buf_size = get_buffer(pb, pd->buf, probe_size); |
448 memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE); | |
448 if (url_fseek(pb, 0, SEEK_SET) < 0) { | 449 if (url_fseek(pb, 0, SEEK_SET) < 0) { |
449 url_fclose(pb); | 450 url_fclose(pb); |
450 if (url_fopen(pb, filename, URL_RDONLY) < 0) { | 451 if (url_fopen(pb, filename, URL_RDONLY) < 0) { |
451 file_opened = 0; | 452 file_opened = 0; |
452 err = AVERROR(EIO); | 453 err = AVERROR(EIO); |
1864 if(last == AV_NOPTS_VALUE || duration_count[index]<=1) | 1865 if(last == AV_NOPTS_VALUE || duration_count[index]<=1) |
1865 last_dts[pkt->stream_index]= pkt->dts; | 1866 last_dts[pkt->stream_index]= pkt->dts; |
1866 | 1867 |
1867 if (st->codec->codec_id == CODEC_ID_NONE) { | 1868 if (st->codec->codec_id == CODEC_ID_NONE) { |
1868 AVProbeData *pd = &(probe_data[st->index]); | 1869 AVProbeData *pd = &(probe_data[st->index]); |
1869 pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size); | 1870 pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE); |
1870 memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size); | 1871 memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size); |
1871 pd->buf_size += pkt->size; | 1872 pd->buf_size += pkt->size; |
1873 memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE); | |
1872 } | 1874 } |
1873 } | 1875 } |
1874 if(st->parser && st->parser->parser->split && !st->codec->extradata){ | 1876 if(st->parser && st->parser->parser->split && !st->codec->extradata){ |
1875 int i= st->parser->parser->split(st->codec, pkt->data, pkt->size); | 1877 int i= st->parser->parser->split(st->codec, pkt->data, pkt->size); |
1876 if(i){ | 1878 if(i){ |