[FFmpeg-devel] [PATCH 01/12] adxdec: validate sample_rate
Paul B Mahol
onemda at gmail.com
Tue Oct 25 13:58:39 EEST 2016
On 10/23/16, Andreas Cadhalpun <andreas.cadhalpun at googlemail.com> wrote:
> A negative sample rate doesn't make sense and triggers assertions in
> av_rescale_rnd.
>
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
> libavformat/adxdec.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
> index cf44531..0315ecb 100644
> --- a/libavformat/adxdec.c
> +++ b/libavformat/adxdec.c
> @@ -109,6 +109,11 @@ static int adx_read_header(AVFormatContext *s)
> return AVERROR_INVALIDDATA;
> }
>
> + if (par->sample_rate <= 0) {
> + av_log(s, AV_LOG_ERROR, "Invalid sample rate %d\n",
> par->sample_rate);
> + return AVERROR_INVALIDDATA;
> + }
> +
> par->codec_type = AVMEDIA_TYPE_AUDIO;
> par->codec_id = s->iformat->raw_codec_id;
> par->bit_rate = par->sample_rate * par->channels * BLOCK_SIZE * 8LL
> / BLOCK_SAMPLES;
> --
> 2.9.3
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
patch(es)have good intent, but better fix is doing/checking it in single place.
More information about the ffmpeg-devel
mailing list