From patchwork Fri Nov 18 16:21:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 17813 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7E4E7BD16B for ; Fri, 18 Nov 2022 16:21:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 952726309B; Fri, 18 Nov 2022 17:21:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1668788500; bh=b0DiHdExjBViuWUS2HuKRRT24zMWcwlNJ+t+QsoWUf4=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=XPN8CyzQz2dxYdV5BIhjmYFQcXY2sZvoKnYSaxRucmugriZlFz/YftT7zIL0UttHs FG4Lk+Rihu84M2Wo/Hg7hahuOOMiaMROGjF7uLuCYiGlg79i2WpMT47HcyN9BHKkBp eQoBePjinK/r/DHTZeL06fdg5p1OY1N3h2nwEtN6yncsHhx0mrQOM/sVSGEc4tK2Y+ wT2oXjCqlbE5cTmbg7ZexuKkz6fvD8sZ7GfY3dzHWxJ0xIgbi/1Y4SguVE6ixEbY05 mrthca8gJ5wg1lkRPr+GtqZ+0nKhVEAkhVv6nwip9UWysZiuMPa8+qwTtYo9agxa2E mq/2htgS5vnhg== Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 954596308D for ; Fri, 18 Nov 2022 17:21:38 +0100 (CET) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id CA9F71BF205; Fri, 18 Nov 2022 16:21:37 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Fri, 18 Nov 2022 17:21:29 +0100 Message-Id: <20221118162129.22866-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] gstreamer: Do not lookup controls by id X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: Rishikesh Donadkar Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The libcamerasrc element looks for the availability of the FrameDurationLimits control by looking it up by numeric control id. The ControlinfoMap::find(unsigned int i) function searches the control numerical identifier on the ContorlInfoMap::idMap_ class member, which might be not initialized if the pipeline handler does not register any control, causing an invalid memory access. Avoid looking up the control by numerical id and use the ControlId instance instead to prevent that. Fixes: ccfe0a1af77c ("gstreamer: Provide framerate support for libcamerasrc") Signed-off-by: Jacopo Mondi Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- src/gstreamer/gstlibcamera-utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.38.1 diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp index 64d197010008..36b9564c4cb4 100644 --- a/src/gstreamer/gstlibcamera-utils.cpp +++ b/src/gstreamer/gstlibcamera-utils.cpp @@ -436,7 +436,7 @@ void gst_libcamera_clamp_and_set_frameduration(ControlList &initCtrls, if (!gst_structure_has_field_typed(element_caps, "framerate", GST_TYPE_FRACTION)) return; - auto iterFrameDuration = cam_ctrls.find(controls::FrameDurationLimits.id()); + auto iterFrameDuration = cam_ctrls.find(&controls::FrameDurationLimits); if (iterFrameDuration == cam_ctrls.end()) { GST_WARNING("FrameDurationLimits not found in camera controls."); return;