From patchwork Thu Sep 15 18:42:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thilo Borgmann X-Patchwork-Id: 37936 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp497201pzh; Thu, 15 Sep 2022 11:43:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4N0JhfZADXy+V1qemVSEhgSmyGbD4m52RcAfC4JtNhMpneU+bTXi7bG+1henhYR6sxWsCY X-Received: by 2002:a17:907:845:b0:731:2f6c:6dbd with SMTP id ww5-20020a170907084500b007312f6c6dbdmr852173ejb.551.1663267390906; Thu, 15 Sep 2022 11:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663267390; cv=none; d=google.com; s=arc-20160816; b=g4jlS52izOvLShD8683aYr8M8rYp1nKGfnQ/qjCOhrbpaVUUEpiEUVVRPBF6FeCFfL yYR52175iq61l1yubOHzTOqqk9tXZmbzOLUg9hTZHuSpuUajEmSoBxlCHrdCjjMAjiRf E6RYb6iqs5z81HWxeUhtz/U4JAtlJr7dzYzYTHySDV4s3i+Xb8YlhzIRi84Wj/sidx9F kybrx4hS1Uvtz+FxhkrP8heoUgFID/d2AVQ6a4JZS6ujYvlFWjJeC6ZrTCvOPVh3ZpoB mFKXVeykaitU5MdcwYw//P6n3ZojWtIumsaUlZvlfG9PTKqOYOnVkUpcNNpvF7tVb9hq gHvQ== 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=fO4lU0jhxg7GRYIzdzvlmPyrdAA+Bg2rcryrQR/ajrk=; b=09H5GBt+LyPwJeDcDlU1XbqsCybV3A8AT3tOrfDIOSyIQ/uckbdVm5/6rPz9SQUW5T yk0WlQCvCq5HXjD0ny3F29Jie9pBcEpmPIt+qhpurCJeAPZzjUemDmKIzsfaZbqpk5cx 64Fkjar0bjWAE+lozs0f/UDjrrz0b2Q2xpTJpKAty9+LbN3XLYk7WGldCgceSbVlND5a 0E8FbyatJ+LrkzzJ4wf5sGaMgupE2Uk+ZghJcGzTZDxKsBmHE99Ua1PLZ9nBFT9xYS0P Ks4E58Sf+kTGmyC8mkyk2kjF+6I8rRgKKRvTI76pv46Kmc0uv0bRMx9E47yqo5UChMvM 4bfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mail.de header.s=mailde202009 header.b=Aq+He0kl; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mail.de Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t24-20020a50ab58000000b00450c8cd976esi82067edc.224.2022.09.15.11.43.10; Thu, 15 Sep 2022 11:43:10 -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=@mail.de header.s=mailde202009 header.b=Aq+He0kl; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mail.de Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 57A5E68BBBA; Thu, 15 Sep 2022 21:43:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from shout01.mail.de (shout01.mail.de [62.201.172.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2C90568BAA7 for ; Thu, 15 Sep 2022 21:43:00 +0300 (EEST) Received: from postfix03.mail.de (postfix03.bt.mail.de [10.0.121.127]) by shout01.mail.de (Postfix) with ESMTP id 985AAA0605 for ; Thu, 15 Sep 2022 20:42:59 +0200 (CEST) Received: from smtp04.mail.de (smtp04.bt.mail.de [10.0.121.214]) by postfix03.mail.de (Postfix) with ESMTP id 7FEA7800F5 for ; Thu, 15 Sep 2022 20:42:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mailde202009; t=1663267379; bh=G4/oHoy2Zt16SdLvn4cu1DydBwKs4X/AfLNG0RAMLts=; h=From:To:Subject:Date:Message-Id:From:To:CC:Subject:Reply-To; b=Aq+He0kltjJh06iYkaxOY58CYr8msLSCXvi1i3zuEPidZpAl+eCwtwmtIogJVowKQ LxLgDtmlQ3f3QhfHj8lbkaOGOVB3aiH74pB7o+l4NAXttza3pSxbm9rDHJxR6j6DNx fBA+ePKFBIxFXUHxnDEf4bvJOKoIE2qgdUF6XdQMn74W+f3kkTIoN7RXGIxKA9qS8c +3Pz6d8zH+GMJc/1rTNZUCcc8S4NPrQaGkwkUu61vE8UD4xCknuGWTkKWKKbA7eQ/c UKk+l6vMLSgtdY64bPtvYAkVRwNJhFLPsk+m+e3OAgyxsRBHWJqGNkF8TPAOzBt30u WRl3SF6XObnsQ== Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp04.mail.de (Postfix) with ESMTPSA id 3B3CFC0040 for ; Thu, 15 Sep 2022 20:42:59 +0200 (CEST) From: Thilo Borgmann To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 20:42:58 +0200 Message-Id: <20220915184258.85103-1-thilo.borgmann@mail.de> MIME-Version: 1.0 X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 1184 X-purgate-ID: 154282::1663267379-000016C9-6BD7E39D/0/0 Subject: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: Fix crash by uninitialized value 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: VkNJFeuTtzy5 If create_cv_pixel_buffer() fails, pixel_buffer_info might get into CFRelease() containing an arbitrary value. --- libavcodec/videotoolboxenc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index bb3065d1d5..dc9e321d3d 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -1440,7 +1440,7 @@ static int vtenc_create_encoder(AVCodecContext *avctx, static int vtenc_configure_encoder(AVCodecContext *avctx) { CFMutableDictionaryRef enc_info; - CFMutableDictionaryRef pixel_buffer_info; + CFMutableDictionaryRef pixel_buffer_info = NULL; CMVideoCodecType codec_type; VTEncContext *vtctx = avctx->priv_data; CFStringRef profile_level = NULL; @@ -1517,8 +1517,6 @@ static int vtenc_configure_encoder(AVCodecContext *avctx) status = create_cv_pixel_buffer_info(avctx, &pixel_buffer_info); if (status) goto init_cleanup; - } else { - pixel_buffer_info = NULL; } vtctx->dts_delta = vtctx->has_b_frames ? -1 : 0;