Browse code

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

Michael Niedermayer authored on 2019/10/21 06:02:27
Showing 1 changed files
... ...
@@ -221,7 +221,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
221 221
                                                            FFALIGN(avctx->width, 16),
222 222
                                                            avctx->height, 1);
223 223
     } else {
224
-        context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16;
224
+        context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample > 8 && avctx->bits_per_coded_sample < 16;
225 225
         context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width,
226 226
                                                        avctx->height, 1);
227 227
     }