From patchwork Wed Sep 20 00:30:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43847 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a886:b0:149:dfde:5c0a with SMTP id ca6csp306902pzb; Tue, 19 Sep 2023 17:30:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKdiuDBCxbfaNIezDZi2ff8zq5j8x1Yf7codz9VEmsWiE1x940qBIJNshYKcnOHMGMqepX X-Received: by 2002:aa7:c58f:0:b0:530:8759:a3ac with SMTP id g15-20020aa7c58f000000b005308759a3acmr1848598edq.2.1695169848253; Tue, 19 Sep 2023 17:30:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695169848; cv=none; d=google.com; s=arc-20160816; b=Bdca80xucah7HXoexF2VtP87Wq+I5QLE0y1Q/hr502bV/d2dSDRIU0eV+Y6txvJWT/ s3RhcOdC9SEtc52kjZpFoC9J8juVBXKfJXRYxz0Ta4g2KGDTB23Bg/GvlLmphLToOKVc 2+09fxL7ueY5+g+qrHh2Sb+U1ijvw/5SiALLxIpytYUoUa4VGptG9N1fFSMFG2/lmxpb aSEhoLAgk+EZCjCbDWQ5BAV/WPlbPAT/2q6ltJVWKsh0PvPcEvcuU6OIWI5fmbocvCdZ ItrwmnKsC1NtK7jOcDYz1c228S1mS8aCsUSWDaafZ8I1Z2ndaw722qUWPlCj6q/YGlVP 6nwg== 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=PQxbdE4DwjhWnVc3Dmld3VLwSc2GyDiZjsq/tGUlpSQ=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=P+x0lxlrTEUmYjH50sEpsOAnM3556vobXDt2rj/WTzqFNmCRytA+85UkHSUINKsW1h Xhm6B/gkpl94DOPhV2bi9VTrN2HmiDjVSuDADGN5z/z8IjIZOTtorbf7EFGnYHPCHic0 BL+w1uZmzNVdQ0mGnFBZyjAV0OSNr/QLF7zHOwUEtikB2cbWzqRBgrp0kv/keZX8AyCr R81mnx7k11jBFzerE2Sysy31jEt6xcScndjrJNjuKiM+9qNO59UV9c8ZLcVrzQH8OAeH 910p5LdnPjsRFZyrLkPu82cvWgjANSTGxquwME1GoyKiqV9a/VN4Ik0g+oQsJ5Xvfo0U LsaA== 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 h26-20020aa7de1a000000b0052596c88933si10848530edv.129.2023.09.19.17.30.46; Tue, 19 Sep 2023 17:30:48 -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 BD18768C907; Wed, 20 Sep 2023 03:30:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3AB2968C397 for ; Wed, 20 Sep 2023 03:30:36 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id E78841BF207 for ; Wed, 20 Sep 2023 00:30:34 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 20 Sep 2023 02:30:30 +0200 Message-Id: <20230920003034.7241-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/5] avcodec/flacdec: Fix overflow in "33bit" decorrelate 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: U+IYeQs74wtf Fixes: signed integer overflow: 538976288 - -9223372036854775808 cannot be represented in type 'long' Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-6275845531238400 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/flacdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 524a0469495..0569f019b3a 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -706,10 +706,10 @@ static void decorrelate_33bps(int ch_mode, int32_t **decoded, int64_t *decoded_3 int i; if (ch_mode == FLAC_CHMODE_LEFT_SIDE ) { for (i = 0; i < len; i++) - decoded[1][i] = decoded[0][i] - decoded_33bps[i]; + decoded[1][i] = decoded[0][i] - (uint64_t)decoded_33bps[i]; } else if (ch_mode == FLAC_CHMODE_RIGHT_SIDE ) { for (i = 0; i < len; i++) - decoded[0][i] = decoded[1][i] + decoded_33bps[i]; + decoded[0][i] = decoded[1][i] + (uint64_t)decoded_33bps[i]; } else if (ch_mode == FLAC_CHMODE_MID_SIDE ) { for (i = 0; i < len; i++) { uint64_t a = decoded[0][i]; From patchwork Wed Sep 20 00:30:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43848 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a886:b0:149:dfde:5c0a with SMTP id ca6csp306979pzb; Tue, 19 Sep 2023 17:31:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6JKbDMBCaBwmtqmV0NKWmoTuqJrBICjjX00YkDOTs/jJoFcN2NDGFWjRQ4SQ8BMi4udOx X-Received: by 2002:a05:6512:e86:b0:500:7fc7:8521 with SMTP id bi6-20020a0565120e8600b005007fc78521mr1203171lfb.64.1695169860922; Tue, 19 Sep 2023 17:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695169860; cv=none; d=google.com; s=arc-20160816; b=TTpCxo28adDDhRrIJB24Fwx6kOtAL8fWpvsIQKKk8VYBnmDfNKH58tkvWahJxNkyOU xsIJ1tZvZ51PlA5Zn0WOXPQgmS0/J+KJ3I0fUKzCeXo3ZE6Hy6E/LbHXpDPTk9s4qgWO lJ6WTysSSi7dqbmhLX7TX0bGhnjX4FUJp/sUNzd18kthC+S/inJAygcBX+UWc8Zea9EB A4NP6D+ecqW2AnLEf1VRLetX7vMV37bdV7MSbE/AfzPQ9kbdV0ILJDPOA3MKbdYDRbUu RmGdwXyO5rTgLSwydaZNlmG5T1LWUpHb4DwZQE73NOmvMdtFbOSSykuvIApnVkYxGflO 7/rQ== 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=uVq6tCiH8x928JDc84VjSAlrHW6W8FiScj8Desch6CI=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=r5B5U4aJU3FMqJCbL4StaLijRJSv11bAPhXBtdxzab5aQWr4ilA2MJQicLbOGp8uqR ZwNKg4aXZd4xzuO3XaRSfq6v60bXEFF5JZK28Q5mg+QISJrlHJ/WRjOqSynqdaOBsqMx DWyZHFUOhFcg7wfPSQbMgRdY76NJPax68F7mrVPtMJJ5eyFMGZYNcLq1JeCbZtQKy1lF yCzFkytpLdSSiwM76bGVmY/rbdcMirPjvLJ93QWelJPPGk0qXIe/zAv/dt1WIDzuRhlP 7gj3/YUQodQaaXxhFTlpnhkkiQsSrBvXMzXW6yvXJv16q5/i3iTF+5p221av3pxXPwiv TW/g== 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 bo8-20020a0564020b2800b0052a3a1c943csi11338318edb.159.2023.09.19.17.30.57; Tue, 19 Sep 2023 17:31:00 -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 D16BD68C90A; Wed, 20 Sep 2023 03:30:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B197C68C60E for ; Wed, 20 Sep 2023 03:30:36 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id E82D9E0002 for ; Wed, 20 Sep 2023 00:30:35 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 20 Sep 2023 02:30:31 +0200 Message-Id: <20230920003034.7241-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230920003034.7241-1-michael@niedermayer.cc> References: <20230920003034.7241-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/5] avcodec/flacdec: Fix integer overflow in "33bit" DECODER_SUBFRAME_FIXED_WIDE() 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: UlbKQOwm9+/C Fixes: signed integer overflow: 4 * 2307917133220067266 cannot be represented in type 'long' Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-6307690022043648 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/flacdec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 0569f019b3a..ed2de14d0a9 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -366,19 +366,19 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded, break; \ case 1: \ for (int i = pred_order; i < blocksize; i++) \ - decoded[i] = (int64_t)residual[i] + (int64_t)decoded[i-1];\ + decoded[i] = (uint64_t)residual[i] + (uint64_t)decoded[i-1];\ break; \ case 2: \ for (int i = pred_order; i < blocksize; i++) \ - decoded[i] = (int64_t)residual[i] + 2*(int64_t)decoded[i-1] - (int64_t)decoded[i-2]; \ + decoded[i] = (uint64_t)residual[i] + 2*(uint64_t)decoded[i-1] - (uint64_t)decoded[i-2]; \ break; \ case 3: \ for (int i = pred_order; i < blocksize; i++) \ - decoded[i] = (int64_t)residual[i] + 3*(int64_t)decoded[i-1] - 3*(int64_t)decoded[i-2] + (int64_t)decoded[i-3]; \ + decoded[i] = (uint64_t)residual[i] + 3*(uint64_t)decoded[i-1] - 3*(uint64_t)decoded[i-2] + (uint64_t)decoded[i-3]; \ break; \ case 4: \ for (int i = pred_order; i < blocksize; i++) \ - decoded[i] = (int64_t)residual[i] + 4*(int64_t)decoded[i-1] - 6*(int64_t)decoded[i-2] + 4*(int64_t)decoded[i-3] - (int64_t)decoded[i-4]; \ + decoded[i] = (uint64_t)residual[i] + 4*(uint64_t)decoded[i-1] - 6*(uint64_t)decoded[i-2] + 4*(uint64_t)decoded[i-3] - (uint64_t)decoded[i-4]; \ break; \ default: \ av_log(s->avctx, AV_LOG_ERROR, "illegal pred order %d\n", pred_order); \ From patchwork Wed Sep 20 00:30:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43849 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a886:b0:149:dfde:5c0a with SMTP id ca6csp307047pzb; Tue, 19 Sep 2023 17:31:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2395m/IyDyhczhY1FlocFb8qDyLhtJzHeSVgwZNnaK00I9eicuow8v3//YgK4Gf1G+1JW X-Received: by 2002:a17:906:cc5c:b0:9ad:a4bd:dc67 with SMTP id mm28-20020a170906cc5c00b009ada4bddc67mr704698ejb.50.1695169867895; Tue, 19 Sep 2023 17:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695169867; cv=none; d=google.com; s=arc-20160816; b=r8pS8QzbWxtK+qNupfBR7zMr+2pRyPVnOoCz6E6kBRr+kSk2mdUjDk9o4fBX1EO/Jc CyrIZrRhfdhKtivw5r3F7DSrwopjgNyZgE+5jY2y1S0q+o0CYeRzSJnFFcr+d6U4lpbU 8pooP3va/xeEcbO2qn/ZyJlQU5eTxkzxVai8r7f53ejuz7f+CAcgtfQFc770D79iUfGF nAUlhIyn2byHqXAYnwARQBALtsTA5zuetHonM27XdXIPvFsA1wHuoGdAOwio/Chw57jC acSIr4XNRHzIBB7tMPGz/rRQMR1j6eRBdVi0a7MM00PqsDS8Gozabfh1nAGy8iWQ7Z3k Nn7g== 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=0QYPuTv54I1p02wbesHJbJABobqPLNE0aaWMKfY43Fc=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=yD79codIWWyPlhbRyj1I037MLMI4c6UUR/0QMxhSCh8bPybj1EWPR8A40tik8/ccnv K7FopzTyJyk3RC/TA21wEo5Ln4bf+lzXmnVL/PiMSke/gPrzxRlpVRsn+VQJrSlaIDSp IL03imHMe0DBptGAMSz3nlOx6pZ0Mv7PuLgfoC8EzWVRCH2g5YUycEGo5Uue1RDbBg+U OzN757TAT/NAOpz9vzj/416Ps/IVTeB62mEisDfTeJZj//96nfNdU3yxEzWxA7jVOn95 UDrlpqwpnq3pU+UmUaDAvU0pcqGqeXXy4farRhf1Y38wjitHFfzbCjTHSvbKgcLwX8Jn qTUQ== 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 b6-20020a170906490600b00992f309cfe9si10772677ejq.598.2023.09.19.17.31.07; Tue, 19 Sep 2023 17:31:07 -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 E2ACD68C91B; Wed, 20 Sep 2023 03:30:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A142168C397 for ; Wed, 20 Sep 2023 03:30:37 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id C88D91C0004 for ; Wed, 20 Sep 2023 00:30:36 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 20 Sep 2023 02:30:32 +0200 Message-Id: <20230920003034.7241-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230920003034.7241-1-michael@niedermayer.cc> References: <20230920003034.7241-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/utvideodec: move allocation to the end of init 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: 4OCHSDU0cWwX Fixes: mem leak Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_UTVIDEO_fuzzer-6666804266926080 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/utvideodec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index 7ee07209d47..4987ee0196a 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -985,10 +985,6 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } - c->buffer = av_calloc(avctx->width + 8, c->pro?2:1); - if (!c->buffer) - return AVERROR(ENOMEM); - av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &h_shift, &v_shift); if ((avctx->width & ((1<height & ((1<buffer = av_calloc(avctx->width + 8, c->pro?2:1); + if (!c->buffer) + return AVERROR(ENOMEM); + return 0; } From patchwork Wed Sep 20 00:30:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43850 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a886:b0:149:dfde:5c0a with SMTP id ca6csp307110pzb; Tue, 19 Sep 2023 17:31:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfqSzUstm3j8+igsq5QTbOnYnzUOX9r0cEXRB0vBynaeWrifF7zn4lzDamdU6sV2piCJ1I X-Received: by 2002:ac2:5f73:0:b0:503:3827:bfa9 with SMTP id c19-20020ac25f73000000b005033827bfa9mr767934lfc.34.1695169878928; Tue, 19 Sep 2023 17:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695169878; cv=none; d=google.com; s=arc-20160816; b=gs6gSVw32CPSq7xT7/B58ny/+faBoAVyg92NCY2+/zu4d3sR+M6QSA7q3tRildmPQ0 pJvztiGAMV4pNNLI1Q9XWniJmzN+YtCFaBXyXKYP3nwrzns2HFxA3zPWnpKJJ0fTIfNk 8hnVBPP7bjy+Pa0icWL2sFY8YY91owOkvGd8xJPVRZjZye1XJNxIUS8ht3mGZv4W3jWm yyUXwqqhtqu8G4n4ecFTYhwaSzKSwmvUK6UkBr0ylcQAaVtPiI5QRZ6XrJ6RJey+P5p3 V8PQ27Od10HOUt3EBGtBssjc6B9cVJGJCrl9QfAUwzpfirCVvaxR7KscyE9n92INc6lm iwhw== 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=MS0a1cYNc71IpmSPFvwhH6ZKLTVMzhuvyc3SBQOg05I=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=jkETi8g46S4yaQGMMD3Zxr0ZeCvrVXHIv3x/eU3fgpWS+VitkxzaX6ux+uBhzhQutK 4TidG9o9DOp0QSfCezuHkJndc3qi1KfISDbyPJ+vBJwzkQp7G5efVnxP/BxYiUgC8V4P OkHaO5tUx6rM3zBlhhhZYIWURxvNxWa/0PiLgNEtM5hFv4GXKmkz1h5mlUcdyKi5hQN8 kqce2Uwve+6UtYCZvEyU9TZbcP9EZlCt/1xXsYDrd7WJ1gnnpQg1He96E+cSXFJQpYUv rjrnomKXYA09/ldXWZq0A98swEH9FkHwmIKG+4eDiSJMd8h1bCyhGXGFDYoWk15P2zzW TTKw== 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 n24-20020a056402061800b0052a1d3bfd90si11148498edv.372.2023.09.19.17.31.17; Tue, 19 Sep 2023 17:31: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 EA30668C919; Wed, 20 Sep 2023 03:30:47 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8994068C90A for ; Wed, 20 Sep 2023 03:30:38 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id BA56560003 for ; Wed, 20 Sep 2023 00:30:37 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 20 Sep 2023 02:30:33 +0200 Message-Id: <20230920003034.7241-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230920003034.7241-1-michael@niedermayer.cc> References: <20230920003034.7241-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/vlc: free multi on fail 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: vb8m8VSYDKsU Fixes: leak Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_UTVIDEO_fuzzer-6449246523752448 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/vlc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c index 3b66c943546..acc081e8b74 100644 --- a/libavcodec/vlc.c +++ b/libavcodec/vlc.c @@ -478,6 +478,7 @@ int ff_vlc_init_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bits, int fail: if (buf != localbuf) av_free(buf); + ff_vlc_free_multi(multi); return AVERROR_INVALIDDATA; } From patchwork Wed Sep 20 00:30:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43851 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a886:b0:149:dfde:5c0a with SMTP id ca6csp307190pzb; Tue, 19 Sep 2023 17:31:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHy8GkkoHzSJF371QiEbN3ycjAgOisTgo8Lgs/TVzM6JQclZUl3Uf3b2Ro3EGvX+xsEMr0F X-Received: by 2002:a17:907:75c8:b0:9a1:b967:aca7 with SMTP id jl8-20020a17090775c800b009a1b967aca7mr643922ejc.42.1695169887407; Tue, 19 Sep 2023 17:31:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695169887; cv=none; d=google.com; s=arc-20160816; b=iUZ9OxEYTtjIxMIMdoF9o+/mMtGb/a1v2poE1cBobaEE4LPOPV5IRpqY1BiSXDAXCU QA7YL8DTlbRMHDIYwCaBQjcOwRmBnmIuYKQOlb+HdBlrJMEh4tS1EC8iAU0vx5QN1d5q +t0pGSQAIEQHyWxZn6Nsmtbh9Km07vROgWIbmxBwNU7lalPKWdvSPM//vramU0Z0v+8j d8bRp7+uPK2NGssPRpghHtMgWTAZa5fVGgJ41Q/cFFXJ9Gt3/sR56bjhIKODg6CuHWcH KRr+LlF80khOnXYS379hxJ87CqoZmkV2y5mpuLp19tFFFuLFSlVD9J+gXntOvyeLL5st AgYQ== 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=x1xGWaa6MoET2XhW4cvUy2YxjEVVyejlaj28L/vNedU=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=K7fQD/XOR4QxplqNnQZYgCVaFbyS1NMSsOA+GF/Cze1eB79OH5UxgE4AGUPow5TEOV GTZ1fbPb7dOb5Rb/ErYhy6fJumnlGhEP+kJ1qry1gMTuPfd3j3IuHjSXABbmMlugdlmT qMzawEcceSpiCRL1UCnysUGfv9uSGl6k52raEtz4u5smJ95cjzRWhQaFpLWagnYEexlI u/yzoHR2ZxiSCgtuRICn09HZSw/YxMcokwjBRt8UX1Dx+LiqCerZZgOMgBYc8UU2wNHf q+JN+by0dj+gIeZbn9ZU7LhCCwT163AKAqPzlXpDOWx3nl7Sh6SfwGAldhcoGmBz7VSM C3KA== 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 p4-20020a17090628c400b009adc86b75a1si8631584ejd.748.2023.09.19.17.31.27; Tue, 19 Sep 2023 17:31:27 -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 D467C68C931; Wed, 20 Sep 2023 03:30:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 87A3A68C912 for ; Wed, 20 Sep 2023 03:30:39 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id B602A20008 for ; Wed, 20 Sep 2023 00:30:38 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 20 Sep 2023 02:30:34 +0200 Message-Id: <20230920003034.7241-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230920003034.7241-1-michael@niedermayer.cc> References: <20230920003034.7241-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 5/5] avformat/avs: Check if return code is representable 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: eN6MB3pHRENe Fixes: leak Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-6738814988320768 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/avs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/avs.c b/libavformat/avs.c index ab47980a11c..19f03731573 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -140,6 +140,10 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt) return 0; /* this indicate EOS */ if (ret < 0) return ret; + if (size != (int)size) { + av_packet_unref(pkt); + return AVERROR(EDOM); + } pkt->stream_index = avs->st_audio->index; pkt->flags |= AV_PKT_FLAG_KEY;