diff mbox

[FFmpeg-devel,2/5] avcodec/wmalosslessdec: Check block_align

Message ID 20191019203950.11689-2-michael@niedermayer.cc
State Accepted
Commit c1c799271eefb8afe22804a710baa5cbaad57d91
Headers show

Commit Message

Michael Niedermayer Oct. 19, 2019, 8:39 p.m. UTC
Fixes: NULL pointer dereference
Fixes: 18331/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5652847445671936

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

Comments

Paul B Mahol Oct. 20, 2019, 8:09 a.m. UTC | #1
LGTM

On 10/19/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: NULL pointer dereference
> Fixes:
> 18331/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMALOSSLESS_fuzzer-5652847445671936
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/wmalosslessdec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
> index eb1db615ae..19bac949d4 100644
> --- a/libavcodec/wmalosslessdec.c
> +++ b/libavcodec/wmalosslessdec.c
> @@ -184,8 +184,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
>      unsigned int channel_mask;
>      int i, log2_max_num_subframes;
>
> -    if (!avctx->block_align) {
> -        av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
> +    if (avctx->block_align <= 0) {
> +        av_log(avctx, AV_LOG_ERROR, "block_align is not set or invalid\n");
>          return AVERROR(EINVAL);
>      }
>
> --
> 2.23.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 Oct. 20, 2019, 4:23 p.m. UTC | #2
On Sun, Oct 20, 2019 at 10:09:45AM +0200, Paul B Mahol wrote:
> LGTM

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index eb1db615ae..19bac949d4 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -184,8 +184,8 @@  static av_cold int decode_init(AVCodecContext *avctx)
     unsigned int channel_mask;
     int i, log2_max_num_subframes;
 
-    if (!avctx->block_align) {
-        av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
+    if (avctx->block_align <= 0) {
+        av_log(avctx, AV_LOG_ERROR, "block_align is not set or invalid\n");
         return AVERROR(EINVAL);
     }