From patchwork Thu Jun 14 15:15:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9410 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:11c:0:0:0:0:0 with SMTP id c28-v6csp2042340jad; Thu, 14 Jun 2018 08:16:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIgYKv33Gph+J9g0vAcjRgyuzEcZ4QROGWTc+2jXgvExE59i6fSqIaTddZT9VkbxlGccFr/ X-Received: by 2002:a1c:5f0b:: with SMTP id t11-v6mr2195513wmb.23.1528989378715; Thu, 14 Jun 2018 08:16:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528989378; cv=none; d=google.com; s=arc-20160816; b=fg7XHK39HYjUDnr3Uf5rMZA0v4CGvBkipfap7j/v6VzcvoBrVjlp2TECyVwwiYbEG/ LD8eY7hz2bbYASm3sY9+RVlj+hzR2YRrdNJ/9HIKvxmlAoJeWkmOTNNTOkK3SCPv2W/R UHEmcqgSI5LNhnfO7Lk5VLMlGELymndZtqW8KFhGxF25KUIRcTUW7sHGwKbhPbF0wEsD 1WPMVGNylWtg6tt4cEaNdCjv2I+cj1d89TUzNG48j9SdD1Co9jXA6kyVhNKBy1zJojtw fAi7tpdSNfKYrx/fYABwN3vHLM5Bqb6/qtPTRRh5dvYVcngxhAWLSYPEoM67nbBJg2Aw HyHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=ywEr1fNfUwyCBx3FSKmfhthFmrGjHU6RsnaqfNlhFnI=; b=g9lZnCfUL/alnDUbUK+YvaI2itDnaQyvNbIS1HTFV9+JKVi5FMhpfuw//2ohPg+1+i SWOMlqT/APqqIafyuZASirPYOt5Ozi2DZkbjCFYXsx1zY4n8892ZngrjVR+rzi5nqPcA 9YhIqnz5rv9gyrfEtJbD6BwF/ONFEOCIYo/sy+zoahs9I0EzaPPUpjrP8iSmcLpEj0DS 8zQWO3EucbmRm8KFq9ScguyvO2nj3vpGEJcz/p7lRvXoxpYTQRLI9EHX/CKnnPOuS7DR fGLMKZju93PWUN/tL5dW0EFvG3BLpz3lXeSemcnMGRN6jF45dhNDNxyQmWPnP9PnkfEL fZqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h130-v6si4330514wmd.76.2018.06.14.08.16.18; Thu, 14 Jun 2018 08:16:18 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AC14068AA3E; Thu, 14 Jun 2018 18:15:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-2.mx.upcmail.net (vie01a-dmta-pe06-2.mx.upcmail.net [84.116.36.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 23DE868A994 for ; Thu, 14 Jun 2018 18:15:04 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fTTyc-0003dG-B9 for ffmpeg-devel@ffmpeg.org; Thu, 14 Jun 2018 17:15:54 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id yfFm1x0040S5wYM01fFnTh; Thu, 14 Jun 2018 17:15:47 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 14 Jun 2018 17:15:15 +0200 Message-Id: <20180614151518.3950-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 1/4] avcodec/decode: Consider STRIDE_ALIGN in get_buffer_internal() when checking width X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 --- 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); }