diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2012-08-18 16:12:41 +0400 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2012-08-18 19:45:58 +0400 |
commit | 92b8c9d89e7ae86bffa05393bb230d5a165b0148 (patch) | |
tree | 7c64fa9739e498b2352b8cc6ed0ed1bcdf11082a /libavformat/au.c | |
parent | 7f46f042d10207412eba433e5896f1356286fe1c (diff) |
lavf/au: check bits per coded sample.
Without that, it would repeatedly produce empty packets
if the codec if forced to something invalid.
Fix trac ticket #1652.
Diffstat (limited to 'libavformat/au.c')
-rw-r--r-- | libavformat/au.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/au.c b/libavformat/au.c index b7654a417a..788e261e70 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -181,10 +181,13 @@ static int au_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret; + int bpcs = av_get_bits_per_sample(s->streams[0]->codec->codec_id); + if (!bpcs) + return AVERROR(EINVAL); ret= av_get_packet(s->pb, pkt, BLOCK_SIZE * s->streams[0]->codec->channels * - av_get_bits_per_sample(s->streams[0]->codec->codec_id) >> 3); + bpcs >> 3); if (ret < 0) return ret; pkt->flags &= ~AV_PKT_FLAG_CORRUPT; |