{"id":22961,"url":"https://patchwork.libcamera.org/api/patches/22961/?format=json","web_url":"https://patchwork.libcamera.org/patch/22961/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20250314202943.112109-2-mzamazal@redhat.com>","date":"2025-03-14T20:29:29","name":"[RFC,1/7] apps: common: Fix flipped error condition","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"90aa1473586bc9717182f55fabd26c127389733f","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/?format=json","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22961/mbox/","series":[{"id":5062,"url":"https://patchwork.libcamera.org/api/series/5062/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5062","date":"2025-03-14T20:29:28","name":"Support different outputs for cam streams","version":1,"mbox":"https://patchwork.libcamera.org/series/5062/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22961/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22961/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 1CB97C32F7\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Mar 2025 20:30:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4FB6468946;\n\tFri, 14 Mar 2025 21:30:08 +0100 (CET)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 36DAA68777\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Mar 2025 21:30:04 +0100 (CET)","from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com\n\t(ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63])\n\tby relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n\tcipher=TLS_AES_256_GCM_SHA384) id us-mta-281-MZsgWWWCPHSpzsJ45JvXeA-1;\n\tFri, 14 Mar 2025 16:30:00 -0400","from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com\n\t(mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com\n\t[10.30.177.40])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (2048 bits)\n\tserver-digest SHA256) (No client certificate requested)\n\tby mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTPS id 8A7F419560AB; Fri, 14 Mar 2025 20:29:59 +0000 (UTC)","from mzamazal-thinkpadp1gen7.tpbc.com (unknown [10.44.32.19])\n\tby mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix)\n\twith ESMTP id 07BD81954B3C; Fri, 14 Mar 2025 20:29:57 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"HMNFeEIH\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1741984203;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tcontent-transfer-encoding:content-transfer-encoding:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=/S2xWvVwFqyo0um4LJ5bkgVbFOmwXjqTH6RNtUr9J2s=;\n\tb=HMNFeEIHNowYMAMtvLc3kO7vQXhWggyA3+37PrxnguLTdYKvo6Mpm7SRMnW6LXXJyExB2e\n\tdsd5OglDG06OVm9t+srJuyehu2iq3rM4k7yvWkwekYko3m0fhBvorX2dJgwOGHs38nLc2p\n\t1WSjPBU4yjN5iruJRs2EiOb/sk+5b88=","X-MC-Unique":"MZsgWWWCPHSpzsJ45JvXeA-1","X-Mimecast-MFC-AGG-ID":"MZsgWWWCPHSpzsJ45JvXeA_1741984199","From":"Milan Zamazal <mzamazal@redhat.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Milan Zamazal <mzamazal@redhat.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"[RFC PATCH 1/7] apps: common: Fix flipped error condition","Date":"Fri, 14 Mar 2025 21:29:29 +0100","Message-ID":"<20250314202943.112109-2-mzamazal@redhat.com>","In-Reply-To":"<20250314202943.112109-1-mzamazal@redhat.com>","References":"<20250314202943.112109-1-mzamazal@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.40","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"2z77uOCstor1Gg0yEZOn6utYs-BVa_v4kefkIYV42_I_1741984199","X-Mimecast-Originator":"redhat.com","Content-Transfer-Encoding":"8bit","content-type":"text/plain; charset=\"US-ASCII\"; x-default=true","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":"When OptionsParser::childOption encounters an error, it returns nullptr\nand the corresponding option.  The check for a nested parent checks for\nan error erroneously, leading not only to a wrong behaviour in case\nthere's no error but also to a segmentation error in case of error due\nto `options' being set to nullptr and accessed later.\n\nSigned-off-by: Milan Zamazal <mzamazal@redhat.com>\n---\n src/apps/common/options.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/src/apps/common/options.cpp b/src/apps/common/options.cpp\nindex cae193cc..29a5d9c7 100644\n--- a/src/apps/common/options.cpp\n+++ b/src/apps/common/options.cpp\n@@ -1095,7 +1095,7 @@ OptionsParser::childOption(const Option *parent, Options *options)\n \t\tstd::tie(options, error) = childOption(parent->parent, options);\n \n \t\t/* Propagate the error all the way back up the call stack. */\n-\t\tif (!error)\n+\t\tif (error)\n \t\t\treturn { options, error };\n \t}\n \n","prefixes":["RFC","1/7"]}