From patchwork Fri Apr 29 18:24:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 35511 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp450685pzb; Fri, 29 Apr 2022 11:24:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVEzeRrTzhpWwzoChUywSfMBxRFtpCn/PYbEwz7SjaV1zV9L45t3cipGA3KTdPVgJs9YEJ X-Received: by 2002:aa7:c04e:0:b0:400:4daf:bab1 with SMTP id k14-20020aa7c04e000000b004004dafbab1mr523714edo.101.1651256693297; Fri, 29 Apr 2022 11:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651256693; cv=none; d=google.com; s=arc-20160816; b=Prs4O63VnI0W60rKH9Wcv4O6a5PyS6zfqQ+A+z+STOCRpeNjNc/OX02no+pFGpx+7J K4uOqWdsTcvfSdh1BJ+F3bljMNsc/HnzuO8lKsY7G7DMxoioOQXt+Cck0LCiCmBArv3E nGZiex8n84BMNcQkglteCpRYekUHkPwHOBEizenTL3c4mWwldD7s4Qvvx3PRS8a+0cQV OjZ+DyuY+3Lej6SzQkO/+NVmGWF+Gr98W1TTewYgg2zcGnPoTSFhycaExYyi1TjGTZYG 0vqcth5Kj5Gg6hrSPaC5QWV4OEWlFJnGMwqOprRVZXdan0o5aL9i8ICBa51yHDZzQwZZ 5A9Q== 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; bh=EdjIsmVdeVvggz1YNQ6kEJDJx0JTnEUQxfRTwkSiitU=; b=IEW4X3pC/1ih3CHBMMsZ+VKbGuMNhZ6oXcjIF+/FXSQeOG343aBBA0yd3Pm5g/B6ai nMIIeYH3ExM+Y07ivNxkUtsm8OGDgcX0Y4024dxtL4EGyBG4o96rEnPgOZcUWokGCy38 9EYUpzwkMsVn5GnYyTqz3Snd30LNVTZNc9kk8H1esXqEPw1MGhy26yBpqxPjhosYewbD SjdJfSU6GiLO6U73zj9se69Jp9G1a2TAYUq/WBDgPOsYMOcPXbr5safO9QowlfpREN6o tCUJs4nM1haeQPsrBnu1RqMiIj4iw5N+E90D4MCAtUxkt+JoRCAPG0tZBiTQcpxOMUss wLPA== 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 wh10-20020a170906fd0a00b006f3b69b9db5si5979906ejb.71.2022.04.29.11.24.51; Fri, 29 Apr 2022 11:24:53 -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 12F3668B2BC; Fri, 29 Apr 2022 21:24:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-at03-2.mx.upcmail.net (vie01a-dmta-at03-2.mx.upcmail.net [62.179.121.152]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 56F0F68B223 for ; Fri, 29 Apr 2022 21:24:32 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1nkVI1-0006Ba-BT for ffmpeg-devel@ffmpeg.org; Fri, 29 Apr 2022 20:24:25 +0200 Received: from ren-mail-psmtp-mg01. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id kVH1nkuF4SgGFkVI1n4biO; Fri, 29 Apr 2022 20:24:25 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg01. with ESMTP id kVHmnZB2qOPqFkVHmnxpBw; Fri, 29 Apr 2022 20:24:10 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.4 cv=OcX7sjfY c=1 sm=1 tr=0 ts=626c2d59 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=NEAV23lmAAAA:8 a=EySw9qhwE_dSPjJTV-AA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 29 Apr 2022 20:24:09 +0200 Message-Id: <20220429182410.5044-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfDryi7iM/cJGcsXDgydMQQLHvbgHv9SHA7D8nTeHYSkYY8ncwdXemDaCJYXeucOKKHKBW79u1ZNKefuDt4vBss9y3Fj6vOyrueWy3Vd88nn7GrmM/qor NetwtvwoCcRcHns/ChsE1X6b74ixkBR4BB+T/wAzmx9M7FsE64RS3EEC6LH5+DhScUpzx+1A1/XGEg== Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/alacdsp: Make intermediates unsigned X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: EQYtDlk1DeHU Fixes: signed integer overflow: -14914387 + -2147418648 cannot be represented in type 'int' Fixes: 46464/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-474307197311385 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/alacdsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/alacdsp.c b/libavcodec/alacdsp.c index 8718d1b6b1..b3c1c424f3 100644 --- a/libavcodec/alacdsp.c +++ b/libavcodec/alacdsp.c @@ -29,12 +29,12 @@ static void decorrelate_stereo(int32_t *buffer[2], int nb_samples, int i; for (i = 0; i < nb_samples; i++) { - int32_t a, b; + uint32_t a, b; a = buffer[0][i]; b = buffer[1][i]; - a -= (int)(b * (unsigned)decorr_left_weight) >> decorr_shift; + a -= (int)(b * decorr_left_weight) >> decorr_shift; b += a; buffer[0][i] = b; From patchwork Fri Apr 29 18:24:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 35510 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a885:b0:7f:4be2:bd17 with SMTP id ca5csp450593pzb; Fri, 29 Apr 2022 11:24:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwImanzXrhvnnDJh244A/s2rvX4dTJEKpIwTjDPLKXCdacA+kyTE3/7UCpJCjqGue+mLb00 X-Received: by 2002:a17:907:6e28:b0:6f3:ce57:97a1 with SMTP id sd40-20020a1709076e2800b006f3ce5797a1mr571629ejc.374.1651256683297; Fri, 29 Apr 2022 11:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651256683; cv=none; d=google.com; s=arc-20160816; b=vLSYnbzKbrvkOKMavQs0FtVt58bBP1wxdgxOyFtJc6UmT4t3y5wxHvHfOMiLbn1hT+ sJE1nLFFpNx9tVPtCMR8XXWb1k1iEX2p8g3tliT/fm1ZWuJRsbWKsar1JoF8//7XCq2t BVVKrhpvfmYUpJFNE3WWhK+4RvinaZtlw8Yso55IWN9M+73/oL9TfY1amGGqlJUH8RZ8 OOtO2EUrv5KDvTLc9kwqW3AHC3A4lCvLZDn2ZsXlWbe1uYDjzpS5mW4M2W4lhdzeAU2N RkIPviX8QnfuwcwUS4zl1FyBpSqT1YafGZrJPGO5I2GPU/+Xt6vCBGlBMXcoHiBtdQuG 9HwA== 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:references:in-reply-to:message-id:date :to:from:delivered-to; bh=IgWVtfNSV865q15GjlXeIKtoMiPJa8qLfzqdAP733yM=; b=BVAaqIEA3Cs3pY1nOJXj3a3xz60HxYnAPQh5fOMYg57nWVtNSS9pVQhkk/yL9WH9sw 30L61VYtb84RDOqT17eN+q0wccxNeKE3uvJMkYSVDwvREsz41ERJVdEz4kKX/DR+7U3F usA0NVe7s+c+1pUsvF3th3brTbaUNayc+8L+7jQbD0m4ue7jUw8iB7dFE+8VVVJOGh/q /2rbFXUVTPpNGW4qciW2mDXgwdYEq2qA7vzZhXvGTXvG6Vbx37C6GW+F/ZUM+/dWYEQi 5FcodlOhsemvSJrLoyRf4nlRyoN6NAk9+rVs7snrVroY3EadretaQQFPdvflQu62ltM6 z/mQ== 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 qf29-20020a1709077f1d00b006f3803478cesi7504213ejc.672.2022.04.29.11.24.42; Fri, 29 Apr 2022 11:24:43 -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 3180868B2AE; Fri, 29 Apr 2022 21:24:39 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-at03-2.mx.upcmail.net (vie01a-dmta-at03-2.mx.upcmail.net [62.179.121.152]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 59EBC68B23D for ; Fri, 29 Apr 2022 21:24:32 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1nkVI1-00063r-BT for ffmpeg-devel@ffmpeg.org; Fri, 29 Apr 2022 20:24:25 +0200 Received: from ren-mail-psmtp-mg01. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id kVI1nkvhKSgGFkVI1n4biP; Fri, 29 Apr 2022 20:24:25 +0200 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg01. with ESMTP id kVHmnZB3FOPqFkVHmnxpBx; Fri, 29 Apr 2022 20:24:10 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.4 cv=OcX7sjfY c=1 sm=1 tr=0 ts=626c2d59 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=NEAV23lmAAAA:8 a=VoiLvOrikwrOPNCf7twA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 29 Apr 2022 20:24:10 +0200 Message-Id: <20220429182410.5044-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220429182410.5044-1-michael@niedermayer.cc> References: <20220429182410.5044-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfDryi7iM/cJGcsXDgydMQQLHvbgHv9SHA7D8nTeHYSkYY8ncwdXemDaCJYXeucOKKHKBW79u1ZNKefuDt4vBss9y3Fj6vOyrueWy3Vd88nn7GrmM/qor NetwtvwoCcRcHns/ChsE1X6b74ixkBR4BB+T/wAzmx9M7FsE64RS3EEC6LH5+DhScUpzx+1A1/XGEg== Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/mpeg4videodec: Check pixel size against packet size X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: 2urW5L0kSu2Q Fixes: Timeout Fixes: 46866/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5114397204283392 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/mpeg4videodec.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index e2bde73639..267a79a62f 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2337,8 +2337,14 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) /* Do the same check as non-studio profile */ if (width && height) { if (s->width && s->height && - (s->width != width || s->height != height)) + (s->width != width || s->height != height)) { + if (width*height / 256 > get_bits_left(gb)) { + av_log(s->avctx, AV_LOG_ERROR, "Impossible size for this frame\n"); + return AVERROR_INVALIDDATA; + } + s->context_reinit = 1; + } s->width = width; s->height = height; } @@ -2485,8 +2491,13 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) if (width && height && /* they should be non zero but who knows */ !(s->width && s->codec_tag == AV_RL32("MP4S"))) { if (s->width && s->height && - (s->width != width || s->height != height)) + (s->width != width || s->height != height)) { + if (width*height/256 > get_bits_left(gb)) { + av_log(s->avctx, AV_LOG_ERROR, "Impossible size for this frame\n"); + return AVERROR_INVALIDDATA; + } s->context_reinit = 1; + } s->width = width; s->height = height; }