X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fau.c;h=b78d1ac18ef8a8421841518dd0576df4ec54b63f;hb=31dfe20dd2fe16c2a3a6816d140b8a32dbdc06ba;hp=67e6cab1815165a4b20befde7f473a26d6b456f4;hpb=6101e5322f083a806fd92a6261ff3197fdd0f5e7;p=ffmpeg diff --git a/libavformat/au.c b/libavformat/au.c index 67e6cab1815..b78d1ac18ef 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -150,6 +150,11 @@ static int au_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } + if (channels == 0 || channels > 64) { + av_log(s, AV_LOG_ERROR, "Invalid number of channels %d\n", channels); + return AVERROR_INVALIDDATA; + } + if (size >= 24) { /* skip unused data */ avio_skip(pb, size - 24); @@ -165,7 +170,7 @@ static int au_read_header(AVFormatContext *s) st->codec->channels = channels; st->codec->sample_rate = rate; if (data_size != AU_UNKNOWN_SIZE) - st->duration = (((int64_t)data_size)<<3) / (st->codec->channels * bps); + st->duration = (((int64_t)data_size)<<3) / (st->codec->channels * (int64_t)bps); avpriv_set_pts_info(st, 64, 1, rate); return 0; } @@ -182,11 +187,8 @@ static int au_read_packet(AVFormatContext *s, av_get_bits_per_sample(s->streams[0]->codec->codec_id) >> 3); if (ret < 0) return ret; + pkt->flags &= ~AV_PKT_FLAG_CORRUPT; pkt->stream_index = 0; - - /* note: we need to modify the packet size here to handle the last - packet */ - pkt->size = ret; return 0; }