[FFmpeg-cvslog] avcodec/rawdec: Check bits_per_coded_sample more pedantically for 16bit cases

Michael Niedermayer git at videolan.org
Sun Dec 1 19:56:45 EET 2019


ffmpeg | branch: release/3.4 | Michael Niedermayer <michael at niedermayer.cc> | Sun Oct 20 23:02:27 2019 +0200| [f3e553e36a98efd6cadf49ae3bdf4171210b521e] | committer: Michael Niedermayer

avcodec/rawdec: Check bits_per_coded_sample more pedantically for 16bit cases

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 at niedermayer.cc>
(cherry picked from commit 5634e2052533fcce46f20c2720b0c8d5f55143ce)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3e553e36a98efd6cadf49ae3bdf4171210b521e
---

 libavcodec/rawdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 1893b26444..2314809ea7 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -221,7 +221,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);
     }



More information about the ffmpeg-cvslog mailing list