[FFmpeg-devel] [PATCH 2/5] avcodec/vc1: Fix overflow in aspect ratio calculation

Jean-Baptiste Kempf jb at videolan.org
Tue Aug 13 11:56:03 EEST 2019


Are those values even acceptable according to spec?
Shouldn't 16k*16K be the maximum allowed?

On Fri, Aug 9, 2019, at 01:26, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 393215 * 14594 cannot be represented in 
> type 'int'
> Fixes: 
> 15728/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3IMAGE_fuzzer-5661588893204480
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavcodec/vc1.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
> index e102b931d8..0790eb160e 100644
> --- a/libavcodec/vc1.c
> +++ b/libavcodec/vc1.c
> @@ -453,8 +453,8 @@ static int decode_sequence_header_adv(VC1Context 
> *v, GetBitContext *gb)
>          } else {
>              av_reduce(&v->s.avctx->sample_aspect_ratio.num,
>                        &v->s.avctx->sample_aspect_ratio.den,
> -                      v->s.avctx->height * w,
> -                      v->s.avctx->width * h,
> +                      v->s.avctx->height * (int64_t)w,
> +                      v->s.avctx->width * (int64_t)h,
>                        1 << 30);
>          }
>          ff_set_sar(v->s.avctx, v->s.avctx->sample_aspect_ratio);
> -- 
> 2.22.0
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".

-- 
Jean-Baptiste Kempf -  President
+33 672 704 734


More information about the ffmpeg-devel mailing list