diff mbox series

[FFmpeg-devel,1/4] avcodec/qdm2: Check fft_coefs_index

Message ID 20200218235919.9360-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/4] avcodec/qdm2: Check fft_coefs_index
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 Feb. 18, 2020, 11:59 p.m. UTC
Fixes: out of array access
Fixes: 20660/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5658290216501248

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

Comments

Paul B Mahol Feb. 19, 2020, 8:35 a.m. UTC | #1
lgtm

On 2/19/20, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: out of array access
> Fixes:
> 20660/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_QDM2_fuzzer-5658290216501248
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/qdm2.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
> index 7b9d50b234..657b2da64d 100644
> --- a/libavcodec/qdm2.c
> +++ b/libavcodec/qdm2.c
> @@ -1334,6 +1334,9 @@ static void qdm2_fft_decode_tones(QDM2Context *q, int
> duration,
>          if (q->frequency_range > (local_int_14 + 1)) {
>              int sub_packet = (local_int_20 + local_int_28);
>
> +            if (q->fft_coefs_index + stereo >=
> FF_ARRAY_ELEMS(q->fft_coefs))
> +                return;
> +
>              qdm2_fft_init_coefficient(q, sub_packet, offset, duration,
>                                        channel, exp, phase);
>              if (stereo)
> --
> 2.17.1
>
> _______________________________________________
> 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 Feb. 19, 2020, 9:14 p.m. UTC | #2
On Wed, Feb 19, 2020 at 09:35:21AM +0100, Paul B Mahol wrote:
> lgtm

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 7b9d50b234..657b2da64d 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1334,6 +1334,9 @@  static void qdm2_fft_decode_tones(QDM2Context *q, int duration,
         if (q->frequency_range > (local_int_14 + 1)) {
             int sub_packet = (local_int_20 + local_int_28);
 
+            if (q->fft_coefs_index + stereo >= FF_ARRAY_ELEMS(q->fft_coefs))
+                return;
+
             qdm2_fft_init_coefficient(q, sub_packet, offset, duration,
                                       channel, exp, phase);
             if (stereo)