diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2012-09-20 01:01:43 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2012-09-24 22:35:29 +0200 |
commit | 7751e4693dd10ec98c20fbd9887233b575034272 (patch) | |
tree | 54e3ad95d7c65d7b44f937b87d1628b737aa56e3 /libavformat/oggdec.c | |
parent | a716006a7d6371a8f124be49d7ce59bcc28f9e53 (diff) | |
download | ffmpeg-7751e4693dd10ec98c20fbd9887233b575034272.tar.gz |
ogg: check that the expected number of headers had been parsed
Not having the header for a codec is a tell-tale of a broken file.
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r-- | libavformat/oggdec.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index e04a4e7973..c8b2a858f1 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -406,6 +406,7 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize, s->data_offset = FFMIN(s->data_offset, cur_os->sync_pos); } }else{ + os->nb_header++; os->pstart += os->psize; os->psize = 0; } @@ -445,7 +446,7 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize, static int ogg_get_headers(AVFormatContext *s) { struct ogg *ogg = s->priv_data; - int ret; + int ret, i; do{ ret = ogg_packet(s, NULL, NULL, NULL, NULL); @@ -453,6 +454,16 @@ static int ogg_get_headers(AVFormatContext *s) return ret; }while (!ogg->headers); + for (i = 0; i < ogg->nstreams; i++) { + struct ogg_stream *os = ogg->streams + i; + + if (os->codec && os->codec->nb_header && + os->nb_header < os->codec->nb_header) { + av_log(s, AV_LOG_ERROR, + "Headers mismatch for stream %d\n", i); + return AVERROR_INVALIDDATA; + } + } av_dlog(s, "found headers\n"); return 0; |