diff mbox

[FFmpeg-devel,3/3] avcodec/wmaprodec: Check that the streams channels do not exceed the overall channels

Message ID 20191012193545.17187-3-michael@niedermayer.cc
State Accepted
Commit e418b315ddd0505e707860f8cc8b796ce06f3458
Headers show

Commit Message

Michael Niedermayer Oct. 12, 2019, 7:35 p.m. UTC
Fixes: NULL pointer dereference
Fixes: 18075/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5708262036471808
Fixes: 18087/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5740627634946048

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

Comments

Paul B Mahol Oct. 12, 2019, 7:45 p.m. UTC | #1
lgtm

On 10/12/19, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: NULL pointer dereference
> Fixes:
> 18075/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5708262036471808
> Fixes:
> 18087/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XMA1_fuzzer-5740627634946048
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/wmaprodec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
> index 5c18479b3b..41ca792548 100644
> --- a/libavcodec/wmaprodec.c
> +++ b/libavcodec/wmaprodec.c
> @@ -437,7 +437,7 @@ static av_cold int decode_init(WMAProDecodeCtx *s,
> AVCodecContext *avctx, int nu
>          av_log(avctx, AV_LOG_ERROR, "invalid number of channels per XMA
> stream %d\n",
>                 s->nb_channels);
>          return AVERROR_INVALIDDATA;
> -    } else if (s->nb_channels > WMAPRO_MAX_CHANNELS) {
> +    } else if (s->nb_channels > WMAPRO_MAX_CHANNELS || s->nb_channels >
> avctx->channels) {
>          avpriv_request_sample(avctx,
>                                "More than %d channels",
> WMAPRO_MAX_CHANNELS);
>          return AVERROR_PATCHWELCOME;
> --
> 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. 13, 2019, 9:53 p.m. UTC | #2
On Sat, Oct 12, 2019 at 09:45:54PM +0200, Paul B Mahol wrote:
> lgtm

will apply

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 5c18479b3b..41ca792548 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -437,7 +437,7 @@  static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu
         av_log(avctx, AV_LOG_ERROR, "invalid number of channels per XMA stream %d\n",
                s->nb_channels);
         return AVERROR_INVALIDDATA;
-    } else if (s->nb_channels > WMAPRO_MAX_CHANNELS) {
+    } else if (s->nb_channels > WMAPRO_MAX_CHANNELS || s->nb_channels > avctx->channels) {
         avpriv_request_sample(avctx,
                               "More than %d channels", WMAPRO_MAX_CHANNELS);
         return AVERROR_PATCHWELCOME;