From patchwork Sun Nov 27 17:03:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39508 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp6960651pzb; Sun, 27 Nov 2022 09:08:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ahzjo4B3CafX/tUmJrdIXRZwLG4tFZL7+N/Jw21F/eHe2M04IywhEJGJXit+cOCX3dWGD X-Received: by 2002:a17:906:2b58:b0:7bf:7e50:111f with SMTP id b24-20020a1709062b5800b007bf7e50111fmr1910339ejg.319.1669568907244; Sun, 27 Nov 2022 09:08:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669568907; cv=none; d=google.com; s=arc-20160816; b=DYXExbOvrkgZ31A5NFgX+BsdxqG9dZi5idA5n7FylHBnnVWDGP//MnDgcISEINtu1+ DZyNFIqT3ZOd7PpRZ0cYkkmu6xSpEotUV/5VLHyxuocUMmmlqL3ewG11xUDF0Aysx1G0 2nFU4NzZ+0xAkQlfX8R1pCoUBQazBWBbNumovpOoJ3IVqG4zP+Hko5kULrtk9YRej8Vh yoAUuUJ6DyD2XNJ8oYYr9fVvmJzIpb4gEK7uSbAyFOMcPstAGBIAIdo1lwRqqphwYNog ZQPoZZX+Yei1Nbxd6Ny3niFkHVyXXFL52OCdeuRWYORu+G8/ET+kUMyuP7uefVaGK1MM 3pNw== 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:delivered-to; bh=8Wl+CZuAaheEIILNnmdxk5VmoLaIkrW1Z5TTWktq2go=; b=N0lYQv0fKwiCaAeJy1eQqlx1UXLAgt6EVS6mbXUcPivv1Rnc3pxtKS0XBld16GMxEK zeEK1itNd+fYhs4uaJqsPcRUKPqCDoOSF4BtGY1nA6vWf0BEhE4ZuECpSP1Z4z3xAexc 5hcP5z1dM+AoQ1q9mo95NVPqZqQvZrnmHqnKhuUiOMjLsb9dRMgcehx4NsGf0xcbjekS 8zDv9/5s2nDLix9V93PMndDtMmrz91dm6PdDafLmer4u13rm3LoNkMdaBGjyDzTbb2gm XZMbFrKQqaEV+hk9t3Yyo+WMPe6TfoHC6LtR8hwsy/AwCAjq2RyUFFvZn0Yk79vE0ga7 Q9aA== 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 vj23-20020a170907131700b0078db1258ae9si5706698ejb.555.2022.11.27.09.08.26; Sun, 27 Nov 2022 09:08:27 -0800 (PST) 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 3CFDA68BBA5; Sun, 27 Nov 2022 19:06:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8892568B9D0 for ; Sun, 27 Nov 2022 19:05:58 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 57C562404F8 for ; Sun, 27 Nov 2022 18:05:54 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id NpXSqALWPUJJ for ; Sun, 27 Nov 2022 18:05:53 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 9E0562406C7 for ; Sun, 27 Nov 2022 18:05:51 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 67BAD3A25CF for ; Sun, 27 Nov 2022 18:05:46 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sun, 27 Nov 2022 18:03:35 +0100 Message-Id: <20221127170351.11477-14-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221127170351.11477-1-anton@khirnov.net> References: <20221127170351.11477-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 14/30] lavc/libx264: do not leave an invalid array size on alloc error 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: iCUhLweLlw17 --- libavcodec/libx264.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index a1b044d4e9..2bbd9044b6 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -1107,8 +1107,10 @@ static av_cold int X264_init(AVCodecContext *avctx) x4->nb_reordered_opaque = x264_encoder_maximum_delayed_frames(x4->enc) + 17; x4->reordered_opaque = av_calloc(x4->nb_reordered_opaque, sizeof(*x4->reordered_opaque)); - if (!x4->reordered_opaque) + if (!x4->reordered_opaque) { + x4->nb_reordered_opaque = 0; return AVERROR(ENOMEM); + } return 0; }