From patchwork Fri Aug 16 23:15:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51048 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b6ca:0:b0:48e:c0f8:d0de with SMTP id s10csp734744vqj; Fri, 16 Aug 2024 16:21:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWmQSoO73jvoO+uTduoxLTktL7Q6JFAQeYw/6bhia7gM3+OBLEur7CN2nmtPyeQlvUb3hKrHp6BA4JytgYCFvKxIMVh5YkhuHMBxw== X-Google-Smtp-Source: AGHT+IHctJYKpMi31OJ81yhQnkg5lU1xW60yrmQHe0hFRyNaNrD4efSHH483eB+pS0jEjttANJ0I X-Received: by 2002:a05:6512:3c84:b0:530:baec:3975 with SMTP id 2adb3069b0e04-5331c6904bamr1817785e87.1.1723850476092; Fri, 16 Aug 2024 16:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723850476; cv=none; d=google.com; s=arc-20160816; b=SN90wLZriyqR9RvfE3gGKw9bx+22j/rDpi/U8tAhsctWd1KFd8jMq6seprY1wJaeUI KvJ3GyySxB9l44a8p9/O4FRkbr+kfHEe5fWpCl2XZ/vEcB3Rn0Ck+DWEfjlVkuEUTYkn RsoZNf6pvcsvICtQ43AtOZ4O7Urhq9gHWqYDEDdiuvmkge8qyqFFozEQSp6cpR0+XRIW //8zA6nA8KHeJ5jI8C0+HkoWk9zBA0hCT1U6CI4L4ySrygU0HGEqtRmWKttmGvELUekC Hd5zmyoocgUYKar+TjCrA6K3wI2n6oVStZrXPavWNevqjVB9NTxHDNnoFYO1qr5KSPOL Ejog== 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=JBUYAwdRM5eJDftEWGPkeWXEbhIOvfi2VhWmynLFitE=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=To2o3IiQtTtinDTUVJa0l+LdijyVKJK5fQ70UUeIwwtAimVSSxK3LXDpNJIzotaN2H Wp2AL+7O2AOw0F9FLMbRMpTbxzcKWdkQ22EbiZ1ZxI1buIuz0VXaCKgR1HZKF2Czg/CK lhpjSlkLpBxXNJ2S4sASuDJDqn1IBGbi1ewIE/CU7m/IV8wQn1ZYsUuH+29xXwP1cCDw sH5+Vh2oK0eDmZr+vFeH91uJc3NTv8HqXXDP+Tyf4BrKpb+fE3Jzh51ZWDH1LG44h2Hb RZ8/kGPmc6d7L0GGoKXZk9r6AONBHFHctoe3uotdsxO5WSmD/ZKDveA8cj/A5eUyaqDm 9jtQ==; 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="e/4lH1qm"; 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 2adb3069b0e04-5330d3aa1b6si1190949e87.55.2024.08.16.16.21.15; Fri, 16 Aug 2024 16:21:16 -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="e/4lH1qm"; 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 5D3BD68DCBA; Sat, 17 Aug 2024 02:15:11 +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 4423268DBFE for ; Sat, 17 Aug 2024 02:15:05 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id A734A60004 for ; Fri, 16 Aug 2024 23:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1723850104; 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=KXcVq2EmQ4JRZDamMd+W8bqIjhk24WSMXY2l2LaINwc=; b=e/4lH1qmPH1wojC6Wk7Q7xsjUsGoJr1g4dNyPR5Fc1ridjN75/7LYdv33IPao/FBsdXHQu BBmYr4UKfRAtRPUK38ofLLe0K4QylVI00ZrrcXcpGdivU+UeVATpD6DdA69Yw3qzhr2WPO rB1Eye9RSPmm830TRZgijeEvQEhcXXc1RZP4p2RBR4WalylkkQfnQ3z8efJirtdoVPpn9j UxcaW0MEwSMU0RHVyIWp477jBdmsNv3mlQ5ywD8LqW889+E2M//oWWWPI9eD5Fg9QsH6nh qOP3rHPGP0PKK/NXFZn+MksRDpyGwMafJpHX7AQnY9NLhUXk7TjDiOKWXtDCxA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 17 Aug 2024 01:15:00 +0200 Message-ID: <20240816231504.3166080-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/5] avcodec/get_buffer: Use av_buffer_mallocz() for audio same as its done for video 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: 63eV9Sh0yk1g Fixes: Use of uninintialized value Fixes: 70993/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_LATM_fuzzer-6378949754552320 For the AAC/USAC/SBR code which reads uninitialized memory, it would be good, if it did not a fix for that is welcome! Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/get_buffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/get_buffer.c b/libavcodec/get_buffer.c index ff19f61e86b..7e705380fc6 100644 --- a/libavcodec/get_buffer.c +++ b/libavcodec/get_buffer.c @@ -142,7 +142,10 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) if (ret < 0) goto fail; - pool->pools[0] = av_buffer_pool_init(pool->linesize[0], NULL); + pool->pools[0] = av_buffer_pool_init(pool->linesize[0], + CONFIG_MEMORY_POISONING ? + NULL : + av_buffer_allocz); if (!pool->pools[0]) { ret = AVERROR(ENOMEM); goto fail; From patchwork Fri Aug 16 23:15:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51049 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b6ca:0:b0:48e:c0f8:d0de with SMTP id s10csp734759vqj; Fri, 16 Aug 2024 16:21:19 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUdhtxyYrcLh1JOGN3Q8g7+9RdQzz6WATMmNVrMXWfAywjGT2rc/dnz3Fh3N1lkecqO++8tk4vOrK5+St57rRSVyPvUO0+11dQbJA== X-Google-Smtp-Source: AGHT+IGDcn1oL/IyrpQ67fGnC94LVS7YxnWXV2xCULVvjImM22Xahop1DzZ0WwB2/Du6dzdWPAm3 X-Received: by 2002:a05:6402:2802:b0:5bd:4001:a80d with SMTP id 4fb4d7f45d1cf-5beca7940b6mr2953953a12.33.1723850478808; Fri, 16 Aug 2024 16:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723850478; cv=none; d=google.com; s=arc-20160816; b=eJC9kAZkiPWxxbqPt8/ToJ/yVDn6CQthVxdSrs+gLFNb6TKHbj+Z2QstQq/QtKM2Z4 Q4oTj9PZFxHus3flttvyn1FdnPNVemMnVXJxFienT3OKrdnQoP3WiyVHcbSBFszRmSEs StQraUDPzPSJhMYzOVeH4L4su1Fis9LZMLwzxXvKRsQxAaBfZ1l/w9mxtQt1bRP1Zowo ylq31IjxOoj3jN/XeAiaXsU7p4Vhf1RIaAajTnk83AxMUZJ0PbpdqYtSwkcuiMIk2Hm3 vqL/ZsDh2ieFlm+ubSpHtZy5vE+Tu0mlnEIjsO+ZEBXjAWsEFvO0gGG0HiClYaL413xW rqQQ== 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=hFpIAddS2ySz9TePBsLrCd38MmBC7PRKNNvBRzTPFOU=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=xeiappxs07+nCd0EW+WzOv/oHMVtFRdIefNLNldQINA04g/cGTb41H2D/sFtG+MCJI qiLK/D0gRyYFldk0vy+gmnlRwgZg9Rz4arlFheddBL4HoreM1NSjKkgPv8eNWkbYGdbN n3v0FdxDZhg3uz1/c2fVcoa1Rw+QS91z6V/ZXjP7rdkprPIQEu5G6MuvhTogRZjxLMpQ ZvGlhKfLvXZD0siA6q4fINLlZ9sdVX+xTK5qVX2lFkpsDx5gsmxXdkb7NMIE1xU8dYY+ nzJeqbIasp1klTXnntkHgiel6a/nZa6AShpCk4/SP6nP+aHNemTTIr/0eH0eO4Svk0+y kWuA==; 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=EudQGAOl; 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-5bebc0b7a88si2432397a12.574.2024.08.16.16.21.18; Fri, 16 Aug 2024 16:21: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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=EudQGAOl; 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 8A3D368DCC1; Sat, 17 Aug 2024 02:15:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 034AA68DCBA for ; Sat, 17 Aug 2024 02:15:05 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 5C572240004 for ; Fri, 16 Aug 2024 23:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1723850105; 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=owJ3E54qXDAPokqenEcvsouO9kZouFzu4okjwyj6wa4=; b=EudQGAOlG1vhgSQAY1TCwIFUdXWVbICCInTNWEuH67WON3krCcYqV8e/J1qyLaUmLKp7GD wlL50O/jMRLtrMVN1VqI2WUSewP1Pi+xsWqePRL6NkIK2M9aajnflNQNDEywbSPLTBKu70 mm8wzXXtuC/4tNG9JUJj2UztF2MBQxSFGOtIXaMzo2p6SogiugShQ9zBzKui1DCWpVWBJm mkErk2Xqn1WT42QjB7nWtAS17lHfm1z5WH877LT69Lg22aztNg+CtM0HuZ7yAO2LKIRnoL dYoaD9qJJ1p7N5xHDalkApd6bgVPNZknp4exzhQH/yiU2txjfXp+69/u258ViQ== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 17 Aug 2024 01:15:01 +0200 Message-ID: <20240816231504.3166080-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240816231504.3166080-1-michael@niedermayer.cc> References: <20240816231504.3166080-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/5] avformat/demux: Check packet duration 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: AMlC4jFVvyNx Fixes: signed integer overflow: 24320 + 9223372036854775573 cannot be represented in type 'long' Fixes: 71001/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-5644785744936960 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/demux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/demux.c b/libavformat/demux.c index dc65f9ad912..bca819a09f7 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -2803,7 +2803,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) av_packet_unref(pkt1); break; } - if (pkt->duration > 0) { + if (pkt->duration > 0 && pkt->duration < INT64_MAX - sti->info->codec_info_duration) { const int fields = sti->codec_desc && (sti->codec_desc->props & AV_CODEC_PROP_FIELDS); if (avctx->codec_type == AVMEDIA_TYPE_SUBTITLE && pkt->pts != AV_NOPTS_VALUE && st->start_time != AV_NOPTS_VALUE && pkt->pts >= st->start_time && (uint64_t)pkt->pts - st->start_time < INT64_MAX From patchwork Fri Aug 16 23:15:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51042 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b6ca:0:b0:48e:c0f8:d0de with SMTP id s10csp732819vqj; Fri, 16 Aug 2024 16:15:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV4fKEq8kNo1hHpsbG/iEu2LbxPeZQ+3OjYq1eQaRFZQfUCScn3uknNUyRrFzDHcGDrkv12YCpDZrJp1prPa479Rdwh3D9wPI84Ug== X-Google-Smtp-Source: AGHT+IGmaKw3aKnrW9I5vWYYlzU0q7YJo4YVlJohjdxfzyRUHCpNSSGi2VC2+0y4lmImYpCs8rEi X-Received: by 2002:a05:6512:1152:b0:52f:42a:a2db with SMTP id 2adb3069b0e04-5332df488e6mr458660e87.28.1723850131610; Fri, 16 Aug 2024 16:15:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723850131; cv=none; d=google.com; s=arc-20160816; b=fXb8eXFJ26+DNlB2JCYdjV04STzt9DshkEIqi/9+8QF6/ekBjDn1zb1gazR70WuSq4 G3kTeHaWJ+6mHUzDsSh7lnwIm1Q7pgZyjL2wunAZMblFHpp75BS7dnhQYDKhnr1iqa11 ipbgXQv41WASIMRlXlWxjX67oCQlAGBBNv27J/u+WTRMhGwuN7qzS96Ftiik6zio7ZHM q/tt33gKJK4SxkONk8DBLnuazAmXV80MmLCew+jpHZKIHdf9+Vw5XT/Og0R9VPct7iPI vbtGbcHJgxsOKN9Zxw+pkFf8E8Ya8Ck2TF5M4MLbyiDKQB0e3achbDVpmZxQC815zBlN 8lFw== 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=T2Rw7F4RPJ9LZptZonbOZVo+8uTZXmDDR1Cu1CJ3YO4=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=oZ/KKFFCUB+FU+hoymN9HocMTsFk8A4xKuIDt31ycBA6mPZq5BH2elCL2ShM46nUDv C5ywakef3LX9OUBPF9JZcV+q+8Kd4nMTiJd4A4Ws/qwxFj3ytPaWQkew69oLF9KjB9Ku xmzRW7aAX3IpKraAwSzgVBVBog7vhOywlQnT2JZcWBgcoYIBEjhI5W2+VSa98rbLTM6K IwhG3bOHFSYjEKjRTpYsORQPHsYA8XCa7v4ZVkPT4gkuDszSZUAU5MUWE514XQb6R8DJ 0gPcvFZ+D/yjS/XsFOZb0j/g8Iy9Djf9ZYxXFGzQ/2ngjMDaeud2FfyhY8Pb1aEVfjvV tQAA==; 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=hCorO6ya; 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-a838397142csi253878266b.773.2024.08.16.16.15.30; Fri, 16 Aug 2024 16:15:31 -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=hCorO6ya; 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 8E39868DCC3; Sat, 17 Aug 2024 02:15:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AB6C868DCBF for ; Sat, 17 Aug 2024 02:15:06 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 0B9C4240006 for ; Fri, 16 Aug 2024 23:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1723850106; 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=YRUeSR2xdu5hhmjsMVMI5dXKZsd8+pjtINXRDx28olI=; b=hCorO6yaGLdGXIlWOBic3+Bkpz97dPu1/4kSO+HTZWMXXck+m00DNCu/YxAy08RMYDdpAw wkgF9mYn3j/diA9qYLTtt6V8Xcw/CY+Ts4U2PUi8kQr1IXPxXxYiuH/EqBusmAP+kBqqnV XXOtqY9EXsaBsGgWrxIPrQlLLdfUFrgr8/xTnvivzBqLb8sTlnho3roKOxtd4q4EGT3GOd QEtbUqNi/1TEBvNM/I3BZZUhPpBMVGQLfwn6rJ36ujsSDIktjv0JT8E2WHI78yC4WP7bkB KEedL5rCnpcwrZzepWbs4hhQ1pdzhyj9wfPQD7lyt91LLZU3T5SsWxxGixLaQw== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 17 Aug 2024 01:15:02 +0200 Message-ID: <20240816231504.3166080-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240816231504.3166080-1-michael@niedermayer.cc> References: <20240816231504.3166080-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/cbs_h265_syntax_template: 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: KXUscOjLmxM4 Fixes: Assertion width > 0 && width <= 32 failed Fixes: 71012/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-6073354744823808 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/cbs_h265_syntax_template.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c index 12fa185c774..d23cb58e863 100644 --- a/libavcodec/cbs_h265_syntax_template.c +++ b/libavcodec/cbs_h265_syntax_template.c @@ -2307,6 +2307,10 @@ SEI_FUNC(sei_3d_reference_displays_info, (CodedBitstreamContext *ctx, RWContext else length = FFMAX(0, (int)current->exponent_ref_display_width[i] + (int)current->prec_ref_display_width - 31); + + if (length > 32) + return AVERROR_PATCHWELCOME; + if (length) ubs(length, mantissa_ref_display_width[i], 1, i); else @@ -2318,6 +2322,10 @@ SEI_FUNC(sei_3d_reference_displays_info, (CodedBitstreamContext *ctx, RWContext else length = FFMAX(0, (int)current->exponent_ref_viewing_distance[i] + (int)current->prec_ref_viewing_dist - 31); + + if (length > 32) + return AVERROR_PATCHWELCOME; + if (length) ubs(length, mantissa_ref_viewing_distance[i], 1, i); else From patchwork Fri Aug 16 23:15:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51047 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b6ca:0:b0:48e:c0f8:d0de with SMTP id s10csp736244vqj; Fri, 16 Aug 2024 16:26:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV7/lYpx/oi5kRGn7ImscMfEOZnVaSiyz/nX6NUD5q3vqfxsmu9CKX2M6qaiaiRq0sJVuAIf1lQEZXYMyEdsNMNG1J5nK6Co2K/Ag== X-Google-Smtp-Source: AGHT+IE1XGtmAx7iKYDY3RXkMUbNjmAnRl8S/xmQD3Kp/atCat6ExFZhbd3b4djGagfrt4vWLSw0 X-Received: by 2002:a17:907:3f1a:b0:a7a:9d1e:3b28 with SMTP id a640c23a62f3a-a8392a38e58mr179272866b.5.1723850775087; Fri, 16 Aug 2024 16:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723850775; cv=none; d=google.com; s=arc-20160816; b=Tce+JvjmPo4etmlyAXciggavvv2vhxhoWkfFoPgBybwFhJAKaGjFktQ+toFbL5v7pn 5fBQJPt8XIVQW09KDg9WzL1wOHygs13BpRixh8mCGemOKAbXpN6ZRwXm1Vr8achkxcpn 5x4XT98sC0ZNlGxgF8yIgMn4mtvlMZXBVMK/JQLzpx28MLb2tRNkwo55/QGko5I4VBa4 i1sDjZs0HGetc0v5u4ck3F8tQ0WVOEr7KcEkDl/hP7ipvq8cdUJxuG+6YwxH14nDLaiV dNtoFCMCWhz2Lp59LLoLH8Z9/v/UNgtS0h01+6+/6xH6LAsuPW5STGzGu3GML+Sb42XB llNg== 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=HIV5uvPKGWdGM8+9ebfqcX2+ljdd+wkZSpp8VbWH8WU=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=j3ZBRgut9c4PRQevwQMxM4dm1mhD2RgLHFNWe6AcP+kVbFjdxWrCbS1qt1EgaBAWP/ mzht+HmIrQzLkgwf9nrjbRMfE24v40l4ugd5cBj9N+DSVZtL3SoTPuDEGunkXvf+3k9F lfk5+OVNhwBUFzPV2i4TCowX7YsPSr2GUhciyxjWqRityY2mMZQSpfGnZo8ytJGZXZc4 HfwPNz51P3kP1Ib4FsKQ5mm8cJPqZlst8f4j7WDeHk7hWe1o8jDsfQbPszq9afbsOXy2 ozOqVtDNTwENwXeuB89ayogky5s4af1QyZ7DPVxkwtuHGrkFiq7ajeWLBa/Wxxz6nSmw jUrw==; 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=EdycKXQ5; 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-a83838c872dsi250392666b.26.2024.08.16.16.26.14; Fri, 16 Aug 2024 16:26:15 -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=EdycKXQ5; 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 A861B68DCCB; Sat, 17 Aug 2024 02:15:15 +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 A79C768DCC2 for ; Sat, 17 Aug 2024 02:15:08 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 44900FF802 for ; Fri, 16 Aug 2024 23:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1723850108; 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=JT+UYfrmA5NlCIncEqmy6JOB04cSA0XbURzvDwPXF9g=; b=EdycKXQ582ByURSpg6rjp09gm+UC5IE1t+BdFULX+1hgWDz0Rrko1skPoQODm0nDhtj9AH srQWtPd1Ks6QpfRNViEnnOAVgo1XkPCPuH53KvWlC+YHkH8FgpAEfk0KMz8vtq88ULgJ9S mez5zEgBagDTznuGFyoB+r7OkYTS7onLkzTyGv9kwuIH/z3fQ9EuYArMOzJOJbPPwolLDQ OdG7DsALAN+zrgolG1CfQHSr6ONAM6bvGytAmz2QVkZOKiOoxrHr49CxHHRL9hsM7iH4Jq qE6lUERWLjSGZaRaS2bMP2LTlDPjNEjD5VPugQ/9BLKjss4JFcFFiUTuf9h/ww== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 17 Aug 2024 01:15:03 +0200 Message-ID: <20240816231504.3166080-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240816231504.3166080-1-michael@niedermayer.cc> References: <20240816231504.3166080-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/hevc/hevcdec: Check refPicList 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: pRHby2Pn5dZK This is likely not the proper way to fix this Fixes: null pointer dereference Fixes: 70781/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5010401476018176 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/hevc/hevcdec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 193d624fc98..dc8497bff12 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -1933,12 +1933,16 @@ static void hls_prediction_unit(HEVCLocalContext *lc, tab_mvf[(y_pu + j) * min_pu_width + x_pu + i] = current_mv; if (current_mv.pred_flag & PF_L0) { + if (!refPicList) + return; ref0 = refPicList[0].ref[current_mv.ref_idx[0]]; if (!ref0 || !ref0->f) return; hevc_await_progress(s, ref0, ¤t_mv.mv[0], y0, nPbH); } if (current_mv.pred_flag & PF_L1) { + if (!refPicList) + return; ref1 = refPicList[1].ref[current_mv.ref_idx[1]]; if (!ref1 || !ref1->f) return; From patchwork Fri Aug 16 23:15:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 51050 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:b6ca:0:b0:48e:c0f8:d0de with SMTP id s10csp736255vqj; Fri, 16 Aug 2024 16:26:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU883OoDFuM5NlLgTIy5k/ufOapPhxcmqA6txVf9vn9oN6N9xxiZ8WW5EtgcH0DNL96u6XRxEAL9ORXnY11HI5Q34yjxcebtkGVwA== X-Google-Smtp-Source: AGHT+IEISBrounkXkNndj3EBk4bs6vgUQeHsaG49i3YpTfSvmZBWR9hxH/CPvgO4NVEL0gy/yLDZ X-Received: by 2002:a05:6512:3d04:b0:52f:c0dd:d168 with SMTP id 2adb3069b0e04-5331c6e53bfmr1546802e87.7.1723850777988; Fri, 16 Aug 2024 16:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1723850777; cv=none; d=google.com; s=arc-20160816; b=HB+E22m1+3OoCIOyhNWzM0vnL8z0c8fbiWXhiuYypUs00bDXPuKvTyHszRbT+trNeE kO3txRoQu/0Tm6FoweaLw3EaYcEHd4xwt9zTipWTq2bQWbLt5QfrCUqN7dKXMtiEGX4u cfG0gHlqQCYSpytjLu4l3kfNqCjRD3sOE/KE/6CXLboaO8GE909RSOO+CKD9vrpaG8dJ tmZzq+u8/5x9X65bMKY+OK5HsJJFOVxHPnXlmQ/S9a8q/TRHfYcCx7Ni+uB2cRYOF8l1 N4xObvEuVWIhVfCMduv6UAEt7+Rix/RYb2aLMVw1t4Azzzh013KppbtwcwPuJMz2d6RZ aWNw== 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=dblFvAkQcGVDXK7MY3xNlLdkc6xQoXPSd7Yn7TRYWP4=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=0BheGAN8lBJKBeuX16NpRdvYi9qpKjIcbo7cuID8CmHIuA5PrMi9ktsF6tqD9LoaE4 QH5cOm8y0REV/Mrs5SGcfsbqFcKBw/KYOh+g72G1WeLnLjzYaDOL5fOSjtjZ7YyWkilN tfgE1UnHaiVrH8wKwfHtexJh4sCkO9LRRtx0qYI4Mx0Wm75lf+THrj9sjXJ7CvLxjuVk +GIFQa0QzQuUrL65bEP6nLhu55vO5g2iPP2F1ITXXANWOwBykK20jx3+EJf+Iedru74R a2qhIRRJunfI/Ey+ls51QOuxN1iZJnZnUSuVmNNJ+KVW+xEX7UcQzNHI3WjV+prdOLVB 6K8A==; 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="e/CJgO7/"; 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 2adb3069b0e04-5330d3b63c0si1292835e87.159.2024.08.16.16.26.17; Fri, 16 Aug 2024 16:26:17 -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="e/CJgO7/"; 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 D8AA968DCD8; Sat, 17 Aug 2024 02:15:16 +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 982DC68DCCC for ; Sat, 17 Aug 2024 02:15:09 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 9A003E0005 for ; Fri, 16 Aug 2024 23:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1723850109; 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=fCQhz7h0Edc0FEMnIVFv9TvvGPLQk2wTLVIfaIvqD1E=; b=e/CJgO7/25CDtrihuBpq/5N/nbtLW76ice1w1/n7Ki6YVRvLDaRxY5KtJ4BpGLwr52fJhb 4DTy9HFJsn56vZEsBYa0wg8+6NBQyLAzRsU2eucBiYn0Jjy0P9PjMg+eqZ8k6g0Zu4Cd7L PAWr+FHYPNIEE0JT9tAZTb55TZtNHYSJGQZAVFTV2eoHwNrVO39U+o9kCDUnJpHxTzhaCI ts/Tu3uOMUJL+KcSpcT3Lj7/I1swfcn3dyvm8JP9PN/D2tBeF4tP5A9JO85H+Q7H+6Ki6y UcAyDTT/SXApKoInbAweHCOE5PuOem12vdreNlC1/qh8bk2C6GSMKWLYkGtAoA== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 17 Aug 2024 01:15:04 +0200 Message-ID: <20240816231504.3166080-5-michael@niedermayer.cc> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240816231504.3166080-1-michael@niedermayer.cc> References: <20240816231504.3166080-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 5/5] avcodec/hevc/ps: use unsigned shift 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: fF7iiVoB5kjW Fixes: left shift of 1 by 31 places cannot be represented in type 'int' Fixes: 70726/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6149928703819776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/hevc/ps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c index 80ac35a7dbf..cd5ece72b0a 100644 --- a/libavcodec/hevc/ps.c +++ b/libavcodec/hevc/ps.c @@ -1101,7 +1101,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, sps->used_by_curr_pic_lt = 0; for (i = 0; i < sps->num_long_term_ref_pics_sps; i++) { sps->lt_ref_pic_poc_lsb_sps[i] = get_bits(gb, sps->log2_max_poc_lsb); - sps->used_by_curr_pic_lt |= get_bits1(gb) * (1 << i); + sps->used_by_curr_pic_lt |= get_bits1(gb) * (1U << i); } }