[FFmpeg-devel,4/5] avcodec/alac: Check for bps of 0

Submitted by Michael Niedermayer on Aug. 8, 2019, 11:23 p.m.

Details

Message ID 20190808232350.16076-4-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer Aug. 8, 2019, 11:23 p.m.
Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 15764/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5102101203517440

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

Comments

Paul B Mahol Aug. 9, 2019, 7:34 a.m.
On Fri, Aug 9, 2019 at 1:26 AM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
> Fixes:
> 15764/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5102101203517440
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by
> <https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by>:
> Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/alac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/alac.c b/libavcodec/alac.c
> index 6086e2caa8..1196925aa7 100644
> --- a/libavcodec/alac.c
> +++ b/libavcodec/alac.c
> @@ -250,7 +250,7 @@ static int decode_element(AVCodecContext *avctx,
> AVFrame *frame, int ch_index,
>
>      alac->extra_bits = get_bits(&alac->gb, 2) << 3;
>      bps = alac->sample_size - alac->extra_bits + channels - 1;
> -    if (bps > 32U) {
> +    if (bps > 32 || bps < 1) {
>          avpriv_report_missing_feature(avctx, "bps %d", bps);
>          return AVERROR_PATCHWELCOME;
>      }
> --
> 2.22.0
>

I'm not sure reporting for missing feature in this case (bps == 0) is valid.



> _______________________________________________
> 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".

Patch hide | download patch | download mbox

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 6086e2caa8..1196925aa7 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -250,7 +250,7 @@  static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index,
 
     alac->extra_bits = get_bits(&alac->gb, 2) << 3;
     bps = alac->sample_size - alac->extra_bits + channels - 1;
-    if (bps > 32U) {
+    if (bps > 32 || bps < 1) {
         avpriv_report_missing_feature(avctx, "bps %d", bps);
         return AVERROR_PATCHWELCOME;
     }