diff mbox series

[FFmpeg-devel] avcodec/vmdaudio: Check block_align more

Message ID 20200106095949.3389-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avcodec/vmdaudio: Check block_align more
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Jan. 6, 2020, 9:59 a.m. UTC
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 19788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMDAUDIO_fuzzer-5743379690553344

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/vmdaudio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Paul B Mahol Jan. 6, 2020, 3:15 p.m. UTC | #1
ok

On 1/6/20, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type
> 'int'
> Fixes:
> 19788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMDAUDIO_fuzzer-5743379690553344
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/vmdaudio.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/vmdaudio.c b/libavcodec/vmdaudio.c
> index c7826fa3ce..dfbd49fd84 100644
> --- a/libavcodec/vmdaudio.c
> +++ b/libavcodec/vmdaudio.c
> @@ -76,7 +76,9 @@ static av_cold int vmdaudio_decode_init(AVCodecContext
> *avctx)
>          av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n");
>          return AVERROR(EINVAL);
>      }
> -    if (avctx->block_align < 1 || avctx->block_align % avctx->channels) {
> +    if (avctx->block_align < 1 || avctx->block_align % avctx->channels ||
> +        avctx->block_align > INT_MAX - avctx->channels
> +    ) {
>          av_log(avctx, AV_LOG_ERROR, "invalid block align\n");
>          return AVERROR(EINVAL);
>      }
> --
> 2.24.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer Jan. 7, 2020, 1:47 a.m. UTC | #2
On Mon, Jan 06, 2020 at 04:15:47PM +0100, Paul B Mahol wrote:
> ok

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/vmdaudio.c b/libavcodec/vmdaudio.c
index c7826fa3ce..dfbd49fd84 100644
--- a/libavcodec/vmdaudio.c
+++ b/libavcodec/vmdaudio.c
@@ -76,7 +76,9 @@  static av_cold int vmdaudio_decode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n");
         return AVERROR(EINVAL);
     }
-    if (avctx->block_align < 1 || avctx->block_align % avctx->channels) {
+    if (avctx->block_align < 1 || avctx->block_align % avctx->channels ||
+        avctx->block_align > INT_MAX - avctx->channels
+    ) {
         av_log(avctx, AV_LOG_ERROR, "invalid block align\n");
         return AVERROR(EINVAL);
     }