[FFmpeg-cvslog] avcodec/decode: Consider STRIDE_ALIGN in get_buffer_internal() when checking width

Michael Niedermayer git at videolan.org
Fri Jun 15 23:27:37 EEST 2018


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Jun 14 15:00:55 2018 +0200| [2e205bfc14d8cecf88f8713275fe8e07454d00b5] | committer: Michael Niedermayer

avcodec/decode: Consider STRIDE_ALIGN in get_buffer_internal() when checking width

STRIDE_ALIGN is not known in libavutil so av_image_check_size* cannot consider it

Fixes: OOM
Fixes: 8291/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-5176528009691136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 421a8f1a35..6a3a4df179 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1837,7 +1837,7 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
     int ret;
 
     if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
-        if ((ret = av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx)) < 0 || avctx->pix_fmt<0) {
+        if ((ret = av_image_check_size2(FFALIGN(avctx->width, STRIDE_ALIGN), avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx)) < 0 || avctx->pix_fmt<0) {
             av_log(avctx, AV_LOG_ERROR, "video_get_buffer: image parameters invalid\n");
             return AVERROR(EINVAL);
         }



More information about the ffmpeg-cvslog mailing list