Commit bc7e128a authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

westwood_aud: prevent division by zero

Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent 9959a52b
......@@ -164,6 +164,12 @@ static int wsaud_read_packet(AVFormatContext *s,
if (ret != chunk_size)
return AVERROR(EIO);
if (st->codecpar->channels <= 0) {
av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n",
st->codecpar->channels);
return AVERROR_INVALIDDATA;
}
/* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
pkt->duration = (chunk_size * 2) / st->codecpar->channels;
}
......
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