On 2/10/12, Ronald S. Bultje <[email protected]> wrote:
> From: "Ronald S. Bultje" <[email protected]>
>
> Prevents a division by zero later on.
> ---
>  libavcodec/tta.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/libavcodec/tta.c b/libavcodec/tta.c
> index 49d5953..2fc1eb4 100644
> --- a/libavcodec/tta.c
> +++ b/libavcodec/tta.c
> @@ -223,6 +223,9 @@ static av_cold int tta_decode_init(AVCodecContext *
> avctx)
>          if (s->channels == 0) {
>              av_log(s->avctx, AV_LOG_ERROR, "Invalid number of channels\n");
>              return AVERROR_INVALIDDATA;
> +        } else if (avctx->sample_rate == 0) {
> +            av_log(s->avctx, AV_LOG_ERROR, "Invalid samplerate\n");
> +            return AVERROR_INVALIDDATA;
>          }
>
>          switch(s->bps) {

TTA Demuxer already checks for that, so this is I guess for other containers.

Such and similar checks (like the one above) just bloats code for
no good reason and should be fixed in nicer and more generic way.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to