Browse Source

westwood_aud: prevent division by zero

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
tags/n3.2
Andreas Cadhalpun 9 years ago
parent
commit
bc7e128a6e
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      libavformat/westwood_aud.c

+ 6
- 0
libavformat/westwood_aud.c View File

@@ -164,6 +164,12 @@ static int wsaud_read_packet(AVFormatContext *s,
if (ret != chunk_size) if (ret != chunk_size)
return AVERROR(EIO); 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 */ /* 2 samples/byte, 1 or 2 samples per frame depending on stereo */
pkt->duration = (chunk_size * 2) / st->codecpar->channels; pkt->duration = (chunk_size * 2) / st->codecpar->channels;
} }


Loading…
Cancel
Save