Commit 09494d09 authored by Dale Curtis's avatar Dale Curtis Committed by Michael Niedermayer

avformat/oggdec: Respect AVERROR codes returned by ogg parsers.

Fixes ticket #6804. All of the ogg header and packet parsers may
return standard AVERROR codes; these return values should not be
treated as success.

Additionally changes oggparsevorbis, to not give up too early
with certain types of poorly muxed files.
Signed-off-by: 's avatarDale Curtis <dalecurtis@chromium.org>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 53c49264
...@@ -543,7 +543,11 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize, ...@@ -543,7 +543,11 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize,
os->incomplete = 0; os->incomplete = 0;
if (os->header) { if (os->header) {
os->header = os->codec->header(s, idx); if ((ret = os->codec->header(s, idx)) < 0) {
av_log(s, AV_LOG_ERROR, "Header processing failed: %s\n", av_err2str(ret));
return ret;
}
os->header = ret;
if (!os->header) { if (!os->header) {
os->segp = segp; os->segp = segp;
os->psize = psize; os->psize = psize;
...@@ -574,8 +578,12 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize, ...@@ -574,8 +578,12 @@ static int ogg_packet(AVFormatContext *s, int *sid, int *dstart, int *dsize,
} else { } else {
os->pflags = 0; os->pflags = 0;
os->pduration = 0; os->pduration = 0;
if (os->codec && os->codec->packet) if (os->codec && os->codec->packet) {
os->codec->packet(s, idx); if ((ret = os->codec->packet(s, idx)) < 0) {
av_log(s, AV_LOG_ERROR, "Packet processing failed: %s\n", av_err2str(ret));
return ret;
}
}
if (sid) if (sid)
*sid = idx; *sid = idx;
if (dstart) if (dstart)
......
...@@ -317,7 +317,7 @@ static int vorbis_header(AVFormatContext *s, int idx) ...@@ -317,7 +317,7 @@ static int vorbis_header(AVFormatContext *s, int idx)
if (priv->packet[pkt_type >> 1]) if (priv->packet[pkt_type >> 1])
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (pkt_type > 1 && !priv->packet[0] || pkt_type > 3 && !priv->packet[1]) if (pkt_type > 1 && !priv->packet[0] || pkt_type > 3 && !priv->packet[1])
return AVERROR_INVALIDDATA; return priv->vp ? 0 : AVERROR_INVALIDDATA;
priv->len[pkt_type >> 1] = os->psize; priv->len[pkt_type >> 1] = os->psize;
priv->packet[pkt_type >> 1] = av_mallocz(os->psize); priv->packet[pkt_type >> 1] = av_mallocz(os->psize);
......
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