diff mbox

[FFmpeg-devel,1/4] avcodec/decode: Consider STRIDE_ALIGN in get_buffer_internal() when checking width

Message ID 20180614151518.3950-1-michael@niedermayer.cc
State Accepted
Commit 2e205bfc14d8cecf88f8713275fe8e07454d00b5
Headers show

Commit Message

Michael Niedermayer June 14, 2018, 3:15 p.m. UTC
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@niedermayer.cc>
---
 libavcodec/decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer June 15, 2018, 7:52 p.m. UTC | #1
On Thu, Jun 14, 2018 at 05:15:15PM +0200, Michael Niedermayer wrote:
> 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

will apply patchset


[...]
diff mbox

Patch

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);
         }