diff mbox

[FFmpeg-devel,1/4] avcodec/rawdec: Check bits_per_coded_sample more pedantically for 16bit cases

Message ID 20191020232059.19471-1-michael@niedermayer.cc
State Accepted
Commit 5634e2052533fcce46f20c2720b0c8d5f55143ce
Headers show

Commit Message

Michael Niedermayer Oct. 20, 2019, 11:20 p.m. UTC
Fixes: shift exponent -14 is negative
Fixes: 18335/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RAWVIDEO_fuzzer-5723267192586240

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

Comments

Michael Niedermayer Nov. 24, 2019, 11:06 p.m. UTC | #1
On Mon, Oct 21, 2019 at 01:20:56AM +0200, Michael Niedermayer wrote:
> Fixes: shift exponent -14 is negative
> Fixes: 18335/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RAWVIDEO_fuzzer-5723267192586240
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/rawdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 53f5b76e93..0b2d8708e6 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -223,7 +223,7 @@  static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
                                                            FFALIGN(avctx->width, 16),
                                                            avctx->height, 1);
     } else {
-        context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16;
+        context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample > 8 && avctx->bits_per_coded_sample < 16;
         context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width,
                                                        avctx->height, 1);
     }