{"id":23430,"url":"https://patchwork.libcamera.org/api/1.1/patches/23430/?format=json","web_url":"https://patchwork.libcamera.org/patch/23430/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250523-fix_segfault_agc-v1-1-aac60d87fd5c@foss.st.com>","date":"2025-05-23T09:56:56","name":"ipa: rpi: Prevent segfault if AGC algorithm is absent","commit_ref":"1ee330c05827c54884d76a53a220eca40930afe5","pull_url":null,"state":"accepted","archived":false,"hash":"e787cb207b551c21855c722ecd9facba9b9cad87","submitter":{"id":227,"url":"https://patchwork.libcamera.org/api/1.1/people/227/?format=json","name":"Benjamin Mugnier","email":"benjamin.mugnier@foss.st.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23430/mbox/","series":[{"id":5193,"url":"https://patchwork.libcamera.org/api/1.1/series/5193/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5193","date":"2025-05-23T09:56:56","name":"ipa: rpi: Prevent segfault if AGC algorithm is absent","version":1,"mbox":"https://patchwork.libcamera.org/series/5193/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23430/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23430/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6B2D5BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 23 May 2025 09:57:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1C20868D96;\n\tFri, 23 May 2025 11:57:39 +0200 (CEST)","from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com\n\t[185.132.182.106])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 567E268D76\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 May 2025 11:57:36 +0200 (CEST)","from pps.filterd (m0241204.ppops.net [127.0.0.1])\n\tby mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id\n\t54N825Uc007895 for <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 May 2025 11:57:35 +0200","from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35])\n\tby mx07-00178001.pphosted.com (PPS) with ESMTPS id 46rwffdgb8-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=NOT) for <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 May 2025 11:57:35 +0200 (MEST)","from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20])\n\tby beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 016404005E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 May 2025 11:57:10 +0200 (CEST)","from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69])\n\tby euls16034.sgp.st.com (STMicroelectronics) with ESMTP id\n\t7EC87ADC260 for <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 May 2025 11:57:05 +0200 (CEST)","from localhost (10.252.4.195) by SHFDAG1NODE1.st.com (10.75.129.69)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39;\n\tFri, 23 May 2025 11:57:05 +0200"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=foss.st.com header.i=@foss.st.com\n\theader.b=\"2LDtOMeK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=\n\tcc:content-transfer-encoding:content-type:date:from:message-id\n\t:mime-version:subject:to; s=selector1; bh=sErVWvV0IUYR1UWFjv0pdg\n\tTlbU3QgRrGwxalmsqhxRk=; b=2LDtOMeK4UUBR5EOLoUAz7hj0jJt4193hskzvs\n\tqBDsPh0xojQSPwjEXLgnFjeB8sVnRiNTaHrdGWwzRe+I+L+/cNyyLZhH8B+cwG7h\n\tpP9Q43XHOOBajGWgdT15DK05+I3jhgnGL3a1kWKsqsEhdPlUEW1buzH0jn6w5shv\n\tSJ4e3uZa3IYD9L1D9NKB6vOYtlm1ts0isigS0hc7EY3+vnNZ9bDF5XOi3ncMTY30\n\trme1ME5dK/TPR/dhCx/qIc0KYkQi+CjfNQcdgRc47TYSNfG6QQX8MKAek+KAkZFr\n\tn7xW9SEHtq35yLMaBN2q1UDaweU581KiXMo3M9BmY982w5jQ==","From":"Benjamin Mugnier <benjamin.mugnier@foss.st.com>","Date":"Fri, 23 May 2025 11:56:56 +0200","Subject":"[PATCH] ipa: rpi: Prevent segfault if AGC algorithm is absent","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-ID":"<20250523-fix_segfault_agc-v1-1-aac60d87fd5c@foss.st.com>","X-B4-Tracking":"v=1; b=H4sIAGdGMGgC/x2MQQqAIBAAvxJ7TjBlCfpKRIiuthAWWhGIf086D\n\tsxMgUyJKcPUFUj0cOYjNhj6DuxmYiDBrjEoqVCi0sLzu2YK3tz7tZpgBXo1aiRHFj207EzUnH8\n\t5L7V+5uBASGIAAAA=","X-Change-ID":"20250523-fix_segfault_agc-5f2735edec5f","To":"<libcamera-devel@lists.libcamera.org>","CC":"Benjamin Mugnier <benjamin.mugnier@foss.st.com>","X-Mailer":"b4 0.14.2","X-Originating-IP":"[10.252.4.195]","X-ClientProxiedBy":"SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com\n\t(10.75.129.69)","X-Proofpoint-Virus-Version":"vendor=baseguard\n\tengine=ICAP:2.0.293, Aquarius:18.0.1099, Hydra:6.0.736,\n\tFMLib:17.12.80.40\n\tdefinitions=2025-05-23_03,2025-05-22_01,2025-03-28_01","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Even without AGC definition in the tuning file, the application would\nstill dereference agc unconditionally, leading to a segmentation fault\nif AGC is absent.\nThis is relevant for sensors already providing AGC/AEC by themselves.\nCheck if AGC is present prior to setting maximum exposure time.\n\nSigned-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>\n---\n src/ipa/rpi/common/ipa_base.cpp | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\n\n---\nbase-commit: ad5326c926831fe7a943d10fd800de43e596f171\nchange-id: 20250523-fix_segfault_agc-5f2735edec5f\n\nBest regards,","diff":"diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex e0a93daa9db229bb2829803fffc6b2f6c8f11061..e0f8b7e782f4340a069a2d7b9cf9dee3141c72df 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -1563,7 +1563,8 @@ void IpaBase::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDu\n \n \tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n \t\tcontroller_.getAlgorithm(\"agc\"));\n-\tagc->setMaxExposureTime(maxExposureTime);\n+\tif (agc)\n+\t\tagc->setMaxExposureTime(maxExposureTime);\n }\n \n void IpaBase::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls)\n","prefixes":[]}