From patchwork Fri Jun 7 00:32:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 49633 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp715659vqo; Thu, 6 Jun 2024 17:32:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXkdmuyQhF3AsEl8m1QEFha1ko1Oqoey/dj24zTg+1FwFIeRGFUZw/AKiXlsUCT5co18W99V/307suuKbVQ7GVpToCgC7V2hiacKw== X-Google-Smtp-Source: AGHT+IF8fXJ8BZHgXhh71uzfRoCfAMrp3LWMthv5/mCmCrhlcwuEjs9CT0QxqHTZiZ7s9Miqsblp X-Received: by 2002:a17:906:aec4:b0:a6c:84e3:fda3 with SMTP id a640c23a62f3a-a6cdb9dc88fmr59345866b.5.1717720348262; Thu, 06 Jun 2024 17:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717720348; cv=none; d=google.com; s=arc-20160816; b=BoCZFtfzMmnKQXvDLyZWgYSJXGfOlJKVBskkYiwNNpTNOsgdbnHc7Ux4eRJFxqAjur ZYhAh7GM1U4myndu2o+fxHNuPpS473nYW+J3+BMDrWYxfGPjZ4iuLLLvQBOfsaQbZO8C F0k2oLEfxxN2WCrMIJYn+muaAvgCj+m9F7/ZI8w7xn0iMTHLPCVCsIpdxE57TNtB0xAc Gkl4ggCN0HUJCulDRlV5YUWi9f1YiGRR22tz5zb6wnsaNPRx+tqMRClHxMRXs59byvQx o+Z9iijX/uNcF0Xfn006l6uqWwZ9rx3ptnlnHaXhlDzScXSDBbn9QwD52AO4rFlKg7Ud jG0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=MXz/18WuOMLKLzzdf6O2RK7NC5irV0fk1VfT6TGJqE8=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=ExFki+ESDyRmoH27Br9ZcZlCJqVVB/rDbuj2AcsdADwbbCg+utzlr9xuAIvVh5AbqN jsk7BRZinPLHF4vbFmvYOHk5abVUINAP47sWm0oKVoEYANNhaqQrc7hJKfWyQomePEVs zeYmlPTgmgIdKgXp9wMdqbeBcUifvtLzoVmfDehAL0PsLdmcTG+qZMS+/wNglGcDiaXa 76SAFybJFmok2ZadEIpeSeYZmquBYIIR70dY+8RhFCqR+SK0IMbm8cZRJ4zvbMeahk9a kTAiIHz8UNggev4/jZ3V9aEzco1GHzr0ov7UcioYxA0nRzKZUxw4JKq/Qt0HLd41jCN4 LOfg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=jAqaFloZ; 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 a640c23a62f3a-a6c806db5cdsi120021466b.364.2024.06.06.17.32.27; Thu, 06 Jun 2024 17:32:28 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=jAqaFloZ; 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 BC09968D72A; Fri, 7 Jun 2024 03:32:24 +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 7238C68D728 for ; Fri, 7 Jun 2024 03:32:17 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 9EF3760002 for ; Fri, 7 Jun 2024 00:32:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1717720336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=XCiGjq20S3ILGYi7Dji5bqwkfRoWB27YJYJZ/6+YBZA=; b=jAqaFloZLmtNm/o0DxgXN1ZuPei5ohE3TNnwy7cWjy8sFhwuH5dDtrN+87OfoNUB3xCMZD Hy6iOraTQO7NvofE/p9TtG/guhWHl2rDeBMjXwoI7lq2rEoVnOrOckKL8w76Xu2hvmWXHL 8FMI4fnArHrUAFIXgESBPVyvkDQPZnJwmlJRnuUnwjVBv/37c93oxukgG9LWsJJ2+DAFfs LwYyXQCYvaU2JVtsP7MLvV8CkeNWz+AzQrh8YlOgUwAOHUFZk25gXHTJlio8JBooANv9FE 8FlWYIPKPvdGSo6ftFYVzZjS4AdHsmSMcsGP7Bv955eQnU42kgYYtrqROdjaEw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 7 Jun 2024 02:32:11 +0200 Message-ID: <20240607003215.1723906-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/5] avformat/mov: Check requested_sample before using it 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: T6IgQosu4AAZ I am not sure the case described by coverity is possible but its more robust checking the argument first Fixes: CID1598441 Improper use of negative value Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 9016cd5ad08..f571b0468ee 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -10161,7 +10161,7 @@ static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, // If we've reached a different sample trying to find a good pts to // seek to, give up searching because we'll end up seeking back to // sample 0 on every seek. - if (!can_seek_to_key_sample(st, requested_sample, next_ts) && sample != requested_sample) + if (sample != requested_sample && !can_seek_to_key_sample(st, requested_sample, next_ts)) break; timestamp = next_ts; From patchwork Fri Jun 7 00:32:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 49634 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp715715vqo; Thu, 6 Jun 2024 17:32:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVP2em9WPjWpcVj5ai68TiO651PdRCj9fzj5RNJzsbpToTOXGuaacbVZS981yOp28fNn51Cg9pwkUoN3+PgfTqHu8raaEnhnNkKuA== X-Google-Smtp-Source: AGHT+IGJVjy/w4mmJ2VYkPlp6ABaBg0ga7Jkkd17LjvzTsRsick0NsIZ2kJr/tjnLRu4A/bb0LK5 X-Received: by 2002:a50:cd9a:0:b0:57a:4a7d:5b9a with SMTP id 4fb4d7f45d1cf-57c50972f7cmr636883a12.26.1717720359178; Thu, 06 Jun 2024 17:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717720359; cv=none; d=google.com; s=arc-20160816; b=MlyaRgQ3lOS/9S4sc9a+mpCmw8q+pElinM723Kz+E8bgWCzr9BFgERFOGYMsEkdL15 C5ysr+UZ+Wc4VUzLiKEPeDYatGfmhiQFYRniZf3tx/4rQKl0/KeTgTjYfQhVvLoMoZah kCCFFLNMW526RUjTAcYFtfYbqYYwPDKb3zSC+/lEJMa5vmUu5BkPfv8gy87UXkT2LJcO TCdYMgzmZee58fBgtldJcu+ajiVaNbYcwunuwzIV3Sr+eBrKSZy1sbwp0jkIdtZjKWw3 Y1v0n1qsaD9BNStDV2O+Xv9hCBRj8Pne5/EVkZxGDL+vuN+LXbGS9zlonwuv29e+jJux Leng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=iozNkihtIdb1PbIF9CvGKL+cvUXIKj64MUwxRV7g024=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=x7ev4F9IeDK1TOdvezUYS5E1+iU0L7rD0R/2Z/lPOiT6+6uTR2HH8kFyZYN7kjKSK1 RRvvNNo/B6HHlEAvEjxjU3mYBWDsu7BE5TccTctT3UBiQRMsn+Tlji9rHAIjfZaxSUyJ dN5i2tOzaWNenQNPwHOKnA2DH6C+IrR9e8iKixhGRBLORxxFEf0i7r0A5b21xmK9Y8FE F0+Ojg1fze0iYp9Bi4ZXwTS11vgajlmG6FLyXxzZLQEPXz7KNAQ33uJX11BbhG4sfDTQ AK44b4TbMkvC3MFAGneIFmSmUNB1VkAVO8c4oaakQsYbjcIJNwJOWt/VFgSCo1elOKu/ SPgQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=Sqk13b98; 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 4fb4d7f45d1cf-57aae2269casi1195111a12.349.2024.06.06.17.32.38; Thu, 06 Jun 2024 17:32:39 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=Sqk13b98; 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 034E468D737; Fri, 7 Jun 2024 03:32:26 +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 BA38C68D6EF for ; Fri, 7 Jun 2024 03:32:18 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 017991BF204 for ; Fri, 7 Jun 2024 00:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1717720338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iqZaf2iM6l5Om/iKlT5CPF7QSiJy6G0GnsIHfHnZi6s=; b=Sqk13b9870hj34BPREbhrfVc5EbZg1enX1HKSc8pMLMbWqCTI5/i9w2IHJDEg/K+XguNWx DBFt8EAJzgWy8GwcrCpDTqNMaecPoYlhAZIsR0Db9z8bRLJOe5LGZYvhec8ZpWMdhoinph aMyoBJMlmufhxHJeYwaDFh67SNa+wKeGdgk792skexsu6ztLII23iWWbiEiCuk8FMpnEbe ZKtbhSclSsO4eOHO4kusE7/9GUlbfz37NsE/3IFCb/MHuVrbgOPvoehbv8RsmPn36bi1dR tXTGsAZNcgHhlm36tmUnpqbjyZK2hxWrtsafM+0DoTeuMk98NOCrWpalpN4EIA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 7 Jun 2024 02:32:12 +0200 Message-ID: <20240607003215.1723906-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240607003215.1723906-1-michael@niedermayer.cc> References: <20240607003215.1723906-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/5] avformat/mpeg: Check len in mpegps_probe() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 0gnOLyImbfjY Fixes: CID1473590 Untrusted loop bound Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/mpeg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 5556861e1c4..c3dff3e4ea2 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -76,6 +76,9 @@ static int mpegps_probe(const AVProbeData *p) int pes = endpes <= i && check_pes(p->buf + i, p->buf + p->buf_size); int pack = check_pack_header(p->buf + i); + if (len > INT_MAX - i) + break; + if (code == SYSTEM_HEADER_START_CODE) sys++; else if (code == PACK_START_CODE && pack) From patchwork Fri Jun 7 00:32:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 49637 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp717919vqo; Thu, 6 Jun 2024 17:39:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXjyYY9+f1Y+u2RW3qv68EFGPkdKrJ/ElU8VqGtt655ZDzKP1YbOOKnoCZ+tySso3edApPovuqU1uovTo7slG6LzxyjYC/G5KGo7Q== X-Google-Smtp-Source: AGHT+IFv47mBZ2wUamI7dcvq1IZ0fkkbmVZpSVg7wglqswTl1HBh6XHt4XJcDoRaY80VbELKlhfx X-Received: by 2002:a19:2d59:0:b0:52b:af52:d0d1 with SMTP id 2adb3069b0e04-52bb9fe2fc8mr568710e87.64.1717720746700; Thu, 06 Jun 2024 17:39:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717720746; cv=none; d=google.com; s=arc-20160816; b=p0faLQBG6r0R6L9LP81vuYDYlPRAX9XXwDNLb8s/NQwJ7YK+X5VpjtB2N/qqOgtGRh hgYHy9mp7YwSGQGqjQkQLR7YbKU9n18Z+fJmFp5eTMzM0zqFObmIjd0QV1HhNAztkHPA /gf62r2PrEpaa7kA7kjo818F20JzUUNPj9LBmviNsZQGnmZamRXwi5RZSO4WcNuQEmcE lSrOwmD/zu5TDEqpk03x5iSRZ+rncQMGHlf6AkUuDdo4f1+F+IDsyLM44T9aPVIZ1xLS mh9YlYAebAahkw7UsJkHNII4TsqqfjNuFGwSSi6U+V+r+z4H+WX6qYwFccgvUbJv94Ah 6mTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=hIlbEBa2Jk9zkHaLuRVe4yQGm2OojICIWrUQkwHbrGA=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=j0DGczCgy/M/7QLz0D2ndra/QIT4fRE5QwrfaCSxLaBMm7WEJFrZWsFC0gQeqJCDAM StoUXsHCZJoyxJkC//KEC2rYO0KJ+PmPhi2yH6QDp1vC0iY1JpSrPdFqXmFAXF0miF+/ 4xShG4+OpPOg5FQI0m1mNtEqsaKkiZR3fxaKwnku8fKfdlqrKI8+NIVHEhk2NKnbBV4l /77SmSbPYyF0kcjFVbdhk8JfW8qOf8/Pwwc143UW54ToTLbq0YstR73x56RgLIegIGyY WAqpNDMt46kCq6V/SInLXunoTE0VrQG7zg62rY66kA9WdvfqNnTKtmrnPv+qkFqDWk1h 4PXg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=kfDmDKhA; 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 a640c23a62f3a-a6c849f0e48si107480266b.228.2024.06.06.17.39.06; Thu, 06 Jun 2024 17:39:06 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=kfDmDKhA; 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 4999168D72F; Fri, 7 Jun 2024 03:32:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 965D068D72F for ; Fri, 7 Jun 2024 03:32:19 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id D913140002 for ; Fri, 7 Jun 2024 00:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1717720339; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GPIOsXe8Bh5ESGzwrNIjWWPHk7cWfOm7IgQ5PtQEisM=; b=kfDmDKhAQEX1kkdmpyo3+D3HSlKnJk2TlHe0e1B8HA1klKZZGpLhtQxvf8LQW2uRqMo1sF vZDhm6DPRxQfrOi73W5HrWcsvtzwWvdkFfQtIYfzGv6gw9H2ZEtG+8Czpb5uA2w12rkYth jryhYlLWMjxcOXo7X0X6dEUUE4kEcbQfgWTP79SSVqU3QAWQf0A2mVJjgKf7HUSicalZPe btoLn7o0z2wUc5tsqB1je2+clLnCbQ10uR/RzR6ZgcnecLICPoZYs0KkHfyw2Gv2olzxMb In5d60s+beVGu5aPelkuYUGKasbzgkwAUkyrhYY7WYbZz1BKKrWbFRPLYrWi5w== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 7 Jun 2024 02:32:13 +0200 Message-ID: <20240607003215.1723906-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240607003215.1723906-1-michael@niedermayer.cc> References: <20240607003215.1723906-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/5] avformat/mxfdec: Check container_ul->desc before use 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: F/3JJtPjxk6e Fixes: CID1592939 Dereference after null check Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/mxfdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index e65cec74c23..820b03940aa 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -3031,6 +3031,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf) if (container_ul->desc) av_dict_set(&st->metadata, "data_type", container_ul->desc, 0); if (mxf->eia608_extract && + container_ul->desc && !strcmp(container_ul->desc, "vbi_vanc_smpte_436M")) { st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codecpar->codec_id = AV_CODEC_ID_EIA_608; From patchwork Fri Jun 7 00:32:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 49635 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp715816vqo; Thu, 6 Jun 2024 17:32:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVjB2XKRja3CGCUaQ1hKhco1CISirz511xm5nYzpgodUPGFvuoz25nKAMnvajK1+yj5FfKiXPVYelI4/NbII9QDXsaxuEc4Ngq6EA== X-Google-Smtp-Source: AGHT+IGY3iQhdHRG6ZVFeiQAisEmc26dZsdjk8PX4xZ2FNSlAqHIroscvpMa77x3a94KMlMy4h/N X-Received: by 2002:a05:651c:1255:b0:2e6:cbe9:db03 with SMTP id 38308e7fff4ca-2eadce3e1e9mr7795111fa.19.1717720378136; Thu, 06 Jun 2024 17:32:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717720378; cv=none; d=google.com; s=arc-20160816; b=Z45mbquSQFq/jdv1bWmvufAfsZznud0Y+xJwketZC8pjQWikZJIp+tBm/0h6AIJZG2 O9NVdMSv2sCzOjzFUaA1NRlI8p9wz7iCGUdmf/umI5VLkBcbn3t761OMouSeC7hspttT Ue2+QIqlru+EeXC2ef6QB0mIh86KCR1qOBBtNDfr0sa1vrUYnGQOUCiHqorcJ/d9L99Z mnIcb7U7Ps5dy2J+rDwxFNrixdzmmcoSm8dMGyzlPsHI6FHCaKr6DCO/vWqr6ybyTFrw jNU2/8WCvBfZaPii/vN3q2wRqX8lAyiCuqI7w5cNSw4mIR6mjmFNnMOseZDKMtRwxvgc s2ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=FBk+G4y6PPjJG2RPHtjlWc5vwijbya8jPpIzgfUEVnM=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=cCTSeFwXon71Rxq6Tv4gyeCQ4n0Yx+IBHAal30RcugEWHa1VpcnBX5f/flRAkckeN4 1ld/Q+5XyoklFqps2vMOIwI01iFemynSOvFZrULmPqlbQxUhOKRGuO4w0a4rZ/UItcQ+ zdUqD3ECl2oiA08Qjo2L03JUplHr4CLCKhphSNo/Uh8667n84FxKhz2hfMtR2k2dJh2x ESOxO+MlhW9PJwog0jgCLJ+M7MF7WUtaoWx1f0HXQckZRguT3yBBPgqc7P8TANWNy2K8 DSSB/ZBOvdIpL7rrWrxvCCSrHtJZIuvHRbYeLX5u77/zscA0hNthlySaZezn204h/bFX POtw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=DOVMLpP0; 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 a640c23a62f3a-a6c80708f99si118453266b.661.2024.06.06.17.32.57; Thu, 06 Jun 2024 17:32:58 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=DOVMLpP0; 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 9B08D68D73C; Fri, 7 Jun 2024 03:32:28 +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 3B72F68D609 for ; Fri, 7 Jun 2024 03:32:20 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 98AA860003 for ; Fri, 7 Jun 2024 00:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1717720339; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M1Iuz0WQdsAKsGs04/9x7JOx5Lmp/J9ondTZZprjd+E=; b=DOVMLpP0E4V3NzcKQE/kagGcKruk0i9uV8aopdTX3Qa37EudT2YY4lE9PW8ZWH6ZDRTk2C Nmc6+tpg3jUvMUZGPkl2TqwFq9hpwKfTxaWk9MMDa3ksl3FkcMV5ks/s+zn/SgScXkq6Hz BewVmR21wsa/l0LkO4zU/Lg7x47rpnG6+PeyYXwmYpy24w/D3kwN1heSqUw+bAOQ6KVrNF YYcLDrwwqCnPYwoA99fUhQPzf1s9Bgf836lbiAFII4vznQrQAgZJZSkP5ialN8/p4z5Cnd 3UYtiBfcvqRgrE5Zohdc51OjdDqL5xghH0R9DAnGL/r8LcL+HWu6uVnisLSeDQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 7 Jun 2024 02:32:14 +0200 Message-ID: <20240607003215.1723906-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240607003215.1723906-1-michael@niedermayer.cc> References: <20240607003215.1723906-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 4/5] avformat/mxfenc: Remove dead code 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: pgoQUY2aD243 Fixes: CID1524681 Logically dead code Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/mxfenc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index f424858fc4e..b8e7bfe3018 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2606,9 +2606,6 @@ static int mxf_parse_ffv1_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt) ff_build_rac_states(&c, 0.05 * (1LL << 32), 256 - 8); v = get_ffv1_unsigned_symbol(&c, state); av_assert0(v >= 2); - if (v > 4) { - return 0; - } if (v > 4) { av_log(s, AV_LOG_ERROR, "unsupported ffv1 version %d\n", v); return 0; From patchwork Fri Jun 7 00:32:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 49636 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp715866vqo; Thu, 6 Jun 2024 17:33:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQUkD3hMnmqPKNIoL5czJQ87s8P00Y1yMd0clAmb0yfD4NhYjCLBYw1acRfbbKFZ82dFTGfR+P7cqy4LchY7V9l6M8+0EFIS1ZWA== X-Google-Smtp-Source: AGHT+IGae4zsOGT4qp9gL2RD8BLmEapnEsNdjKB4O7z4m8Y+c0LxZH+KcPkEYDDkGy2Q4Eday3bP X-Received: by 2002:a50:f615:0:b0:57a:273e:d8e8 with SMTP id 4fb4d7f45d1cf-57c509b66a1mr507834a12.39.1717720388199; Thu, 06 Jun 2024 17:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717720388; cv=none; d=google.com; s=arc-20160816; b=wOCMkAROeP0NOHrI+CzfA3BjtjSfFhSPomqf1N7JMmj7tRVarn8ZXz4UVLcPJiaQW2 ry4zuyqv0yQBtXu/mAR48b2K9Tpwc6CQYq+rGKAodekGt63R1P/gcS7Omw5I8IL57pvr WbMSQ2sYI5/YRaGt7SM/+VWfBXD2+iYaEtUsGFyLPCVOEgnbE/R0cji1+Km0MX+/vcLi 1IYEyzShDYIOtmC1vG6o4NutNin5BKEi8As3HSMOY1itDOWLhga+uyr8HKEMW3tJJtzL GdEJhaDkblcmB1UbqOvraqgQyaJFQUhnvmTFtnDoL0XBzC5vy/mXS+4vxQ21/lBQQiRL Y9rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=uXKAzJFnz/mWErOLXnX1+mBaEqyWpflB7dfB2gMcwGE=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=qI0t5F6wSwjaEuIVunmv4hhs/aAl3SDtHKtGgl0XGQmCI2y9cBHUgT58df+UO1jOsg pAYNiFIevaVwZAk68XseLFmkbPy7kStAvwjfihz3Cuaz29dVEPHMAVwpOy27B5B/v38H W2QlfQtpAEjhIkDehegHkR5+mi3yhWqettblGqviG8eywcjkEXEYVhKXLsxt/H2IUQ2a z25FKSIyEXScYIv9MqN63HBaQLsnfSSfYT8EzP/Y1gJ8OZp+THzpbMA310l02qT8XZh3 LpMHc2E6ckooJkI0es6JbVMJi2hRx0/m1eortx8gfRuVaqQLA+7KfY02ZGRQVGKhIk55 jlpQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=n8tbbNLu; 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 4fb4d7f45d1cf-57aae0fce00si1175082a12.187.2024.06.06.17.33.07; Thu, 06 Jun 2024 17:33:08 -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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=n8tbbNLu; 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 E709D68D749; Fri, 7 Jun 2024 03:32:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 718C668D72C for ; Fri, 7 Jun 2024 03:32:21 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id AE284FF802 for ; Fri, 7 Jun 2024 00:32:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1717720340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5W6QlzQl7pcZAcoDVOmTlqeqtNf3oWwWIONzMlhZHNM=; b=n8tbbNLuyUsH2k+/o8a7H7XCmACacfhjo88LPpVNp6avcS2zUcsHq/Iyl9sMM9C2ZnAGhW RGQMTcFVv35gWA3aOc2l8fibV8/+EUSIOwDLkfw4If7PZ0I8RTeXJKfTOV66Od9h3O9Raa 8BFQxib4WS4B0yGnTwIMTa3XKuRFOXAr0jUZGIFMII05Lny0jAyIDJb7ug7MyfmutiNicT WfwXf1/9xVu8isEiyGyK67l/jQKp1FRDDsFhu2Mjk4rRUUmhL11fGrRiU8fEQ1Saq4mrWv ohr0Vd0jO52THeSNNIaIqG2qKSuMNJ/GiAeICsd7xYhw6UG25UpZJGG1AE+I1A== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 7 Jun 2024 02:32:15 +0200 Message-ID: <20240607003215.1723906-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240607003215.1723906-1-michael@niedermayer.cc> References: <20240607003215.1723906-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 5/5] avformat/rdt: Check pkt_len 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: tK3C2Dqv2yE2 Fixes: CID1473553 Untrusted loop bound Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavformat/rdt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 60449d256a5..2fa53d34a8d 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -206,6 +206,8 @@ ff_rdt_parse_header(const uint8_t *buf, int len, return -1; /* not followed by a data packet */ pkt_len = AV_RB16(buf+3); + if (pkt_len > len) + return AVERROR_INVALIDDATA; buf += pkt_len; len -= pkt_len; consumed += pkt_len;