[{"id":26860,"web_url":"https://patchwork.libcamera.org/comment/26860/","msgid":"<20230405082118.ckfmkf5ukdlfps7x@uno.localdomain>","date":"2023-04-05T08:21:18","subject":"Re: [libcamera-devel] [PATCH v2 2/2] test: controls:\n\tcontrol_info_map: Test default constructor","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Mattijs,\n\nOn Wed, Apr 05, 2023 at 10:14:31AM +0200, Mattijs Korpershoek wrote:\n> ControlInfoMap can be default-constructed. In that case, some of its\n> members (like idmap_) can be a nullptr, and ControlInfoMap.find() will segfault.\n>\n> Add a test with a default constructed ControlInfoMap to cover this.\n>\n> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n   j\n\n> ---\n>  test/controls/control_info_map.cpp | 7 +++++++\n>  1 file changed, 7 insertions(+)\n>\n> diff --git a/test/controls/control_info_map.cpp b/test/controls/control_info_map.cpp\n> index db95945a1580..29b33515e48c 100644\n> --- a/test/controls/control_info_map.cpp\n> +++ b/test/controls/control_info_map.cpp\n> @@ -75,6 +75,13 @@ protected:\n>  \t\t\treturn TestFail;\n>  \t\t}\n>\n> +\t\t/* Test looking up a control on a default-constructed infoMap */\n> +\t\tconst ControlInfoMap emptyInfoMap;\n> +\t\tif (emptyInfoMap.find(12345) != emptyInfoMap.end()) {\n> +\t\t\tcerr << \"find() on empty ControlInfoMap failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n>  \t\treturn TestPass;\n>  \t}\n>  };\n>\n> --\n> 2.39.2\n>","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 DE6C9BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  5 Apr 2023 08:21:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 583A762754;\n\tWed,  5 Apr 2023 10:21:23 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2ED3661EC4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Apr 2023 10:21:22 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2001:b07:5d2e:52c9:1cf0:b3bc:c785:4625])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 96793308;\n\tWed,  5 Apr 2023 10:21:21 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1680682883;\n\tbh=Xm1WHIcOGpVjYTb7w3vf0EvT54zHII5tiYAM4LL+NEo=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Wc9cLLWMVtyUUBXSIJFC1VZlPcDhK4IlTo9hgm9r+Pk2hDj4boEsbUHzSbnQ9+4bf\n\tz9BKU5qPUIDtz+O7pLmMU88JC2Idj7GLlSg6y3lKCNLBnyG3uEL1dbFEJLut0P1ngd\n\tQEhvqvfLZGiSk84wO0T2Nh0hQDPb1c9uwfkqY8FngpURNUfxDlWYOKqtYyhMLgSnPX\n\tSbSsuMukrg8/Dd06tcb9znuN2pGAPTeemKBgf2521RfH+1cS5nP3qm6828JqvlXS8G\n\tt+V+dqf/5z0owr5+hYFjfL5UumV0XpFlTOCLoEwEqkRUscoNY8lWu5DloFjszeYRj3\n\tJ9D/+Z01RbsOg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1680682881;\n\tbh=Xm1WHIcOGpVjYTb7w3vf0EvT54zHII5tiYAM4LL+NEo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=uTw8yVMyU/FqYOD8/UjiVYMQZ0lgarAHuCY0fNY21sS9rzVjKMch+Xu5ZaES52Wtj\n\t1LYmRCDcQxLbvHtydCUUNYtO2Wgs6+HIVokZTi8VTQAPEyEib6hUAVzh/gkvdDW7yh\n\tZ17T8w8XLFlW70fmGlK0P76CVKVwnotSJcWrlO64="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"uTw8yVMy\"; dkim-atps=neutral","Date":"Wed, 5 Apr 2023 10:21:18 +0200","To":"Mattijs Korpershoek <mkorpershoek@baylibre.com>","Message-ID":"<20230405082118.ckfmkf5ukdlfps7x@uno.localdomain>","References":"<20230404-guard-idmap-v2-0-444d135b3895@baylibre.com>\n\t<20230404-guard-idmap-v2-2-444d135b3895@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230404-guard-idmap-v2-2-444d135b3895@baylibre.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/2] test: controls:\n\tcontrol_info_map: Test default constructor","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>","From":"Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26884,"web_url":"https://patchwork.libcamera.org/comment/26884/","msgid":"<8882f79b-9802-29a1-2d0c-3afb7288b5c1@ideasonboard.com>","date":"2023-04-17T06:22:47","subject":"Re: [libcamera-devel] [PATCH v2 2/2] test: controls:\n\tcontrol_info_map: Test default constructor","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Mattijs\n\nOn 4/5/23 1:44 PM, Mattijs Korpershoek via libcamera-devel wrote:\n> ControlInfoMap can be default-constructed. In that case, some of its\n> members (like idmap_) can be a nullptr, and ControlInfoMap.find() will segfault.\n>\n> Add a test with a default constructed ControlInfoMap to cover this.\n>\n> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n> ---\n>   test/controls/control_info_map.cpp | 7 +++++++\n>   1 file changed, 7 insertions(+)\n>\n> diff --git a/test/controls/control_info_map.cpp b/test/controls/control_info_map.cpp\n> index db95945a1580..29b33515e48c 100644\n> --- a/test/controls/control_info_map.cpp\n> +++ b/test/controls/control_info_map.cpp\n> @@ -75,6 +75,13 @@ protected:\n>   \t\t\treturn TestFail;\n>   \t\t}\n>   \n> +\t\t/* Test looking up a control on a default-constructed infoMap */\n> +\t\tconst ControlInfoMap emptyInfoMap;\n> +\t\tif (emptyInfoMap.find(12345) != emptyInfoMap.end()) {\n> +\t\t\tcerr << \"find() on empty ControlInfoMap failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n>   \t\treturn TestPass;\n>   \t}\n>   };\n>","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 2CCCBBD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 17 Apr 2023 06:22:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5D7ED627B8;\n\tMon, 17 Apr 2023 08:22:55 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 706B361EB8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 17 Apr 2023 08:22:53 +0200 (CEST)","from [IPV6:2401:4900:1f3f:5cdb:e901:bf75:5c47:99c1] (unknown\n\t[IPv6:2401:4900:1f3f:5cdb:e901:bf75:5c47:99c1])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 573EEF95;\n\tMon, 17 Apr 2023 08:22:47 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681712575;\n\tbh=LPxie/aK/3JZ1pWpbSILHo6kK6qecYJhHJpgMFEC+tA=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=vFjGdEPSJZ4PBNpCgwf0Mm3DoxPNMaFPc7pBTzV1OYtVcK6UoQdiHzluNyrHfY+tO\n\tLJzP9mteOkFz8XkOYwETTUCymQTPbgn+706vFdWdSt4iw8E1q2Y7XC/JMD2W+/OuPm\n\tAw76vBXf3wmNYtO9NRaqtEbY44N4TuJ1VOxVoersznTypdcxn/pMl9iCOg+1nKF9Wc\n\tsfNGWwNTl7fRQl4nnm+n3DIk/xe0y6LcWu4Ln4M9iI8J8p4RgtWOoxkTtJX+eKQyMj\n\t1GRafOgDCeyfgxtn+RTgOY50JM/7EuA25+mcn6Xbz0bYbPMFpnvm2r3UUsLpL9RfCt\n\txLWm5mwqyd4Bg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1681712568;\n\tbh=LPxie/aK/3JZ1pWpbSILHo6kK6qecYJhHJpgMFEC+tA=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=aT9Jsw0UdcjJ7K+b2/MWoKJs0UqjUTDXAYkUtC1vtPk66vtv6VMwEa8nRD1P5HYyK\n\tRfiqZxaFRvyFNH6K+UESHhRZ1Q5Zq4PNOQQOh6W7S6WwvRgaBMTFVZiGeBH2UKNCH0\n\tfcht04ULZuZA8kSBuvJl92cJaA65m3kfG0hRUglA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"aT9Jsw0U\"; dkim-atps=neutral","Message-ID":"<8882f79b-9802-29a1-2d0c-3afb7288b5c1@ideasonboard.com>","Date":"Mon, 17 Apr 2023 11:52:47 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101\n\tThunderbird/102.7.1","To":"Mattijs Korpershoek <mkorpershoek@baylibre.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20230404-guard-idmap-v2-0-444d135b3895@baylibre.com>\n\t<20230404-guard-idmap-v2-2-444d135b3895@baylibre.com>","Content-Language":"en-US","In-Reply-To":"<20230404-guard-idmap-v2-2-444d135b3895@baylibre.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v2 2/2] test: controls:\n\tcontrol_info_map: Test default constructor","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>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26915,"web_url":"https://patchwork.libcamera.org/comment/26915/","msgid":"<20230420102230.GA11005@pendragon.ideasonboard.com>","date":"2023-04-20T10:22:30","subject":"Re: [libcamera-devel] [PATCH v2 2/2] test: controls:\n\tcontrol_info_map: Test default constructor","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hello Mattijs,\n\nThank you for the patch.\n\nOn Wed, Apr 05, 2023 at 10:14:31AM +0200, Mattijs Korpershoek wrote:\n> ControlInfoMap can be default-constructed. In that case, some of its\n> members (like idmap_) can be a nullptr, and ControlInfoMap.find() will segfault.\n\nNot anymore with patch 1/2 :-) It's however best to add the test first,\nto verify it fails, and then the fix, to verify it fixes the problem.\nWith patch 1/2 and 2/2 swapped, I would phrase the commit message of\nthis patch as\n\n--------\nControlInfoMap can be default-constructed. In that case, some of its\nmembers (like idmap_) can be a nullptr. Add a test to ensure that the\nfind() function doesn't segfault.\n\nThe test is expected to fail, the issue will be fixed by a subsequent\ncommit.\n--------\n\n> Add a test with a default constructed ControlInfoMap to cover this.\n> \n> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n> ---\n>  test/controls/control_info_map.cpp | 7 +++++++\n>  1 file changed, 7 insertions(+)\n> \n> diff --git a/test/controls/control_info_map.cpp b/test/controls/control_info_map.cpp\n> index db95945a1580..29b33515e48c 100644\n> --- a/test/controls/control_info_map.cpp\n> +++ b/test/controls/control_info_map.cpp\n> @@ -75,6 +75,13 @@ protected:\n>  \t\t\treturn TestFail;\n>  \t\t}\n>  \n> +\t\t/* Test looking up a control on a default-constructed infoMap */\n\ns/infoMap/infoMap./\n\nWith this,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t\tconst ControlInfoMap emptyInfoMap;\n> +\t\tif (emptyInfoMap.find(12345) != emptyInfoMap.end()) {\n> +\t\t\tcerr << \"find() on empty ControlInfoMap failed\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n>  \t\treturn TestPass;\n>  \t}\n>  };","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 00403BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 20 Apr 2023 10:22:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 36625627C1;\n\tThu, 20 Apr 2023 12:22:19 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 40079603A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 20 Apr 2023 12:22:18 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(133-32-181-51.west.xps.vectant.ne.jp [133.32.181.51])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D15855AA;\n\tThu, 20 Apr 2023 12:22:09 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681986139;\n\tbh=/4jPma8DzdV+OKCwwIO5ZReCOQN6/9Li36bic45tYTg=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=XV5N7nogybW9XjjrMC0Q3gOHrghQikxo/WW+Mb9RHThb1+54H50tYPsgKsIm/Rmsl\n\td1aCnZFPJo3ORX7oYq2sbxUEHZBLjnVj9VWpnmZSSCwl5XHhJZFAoKkkdErFRpZ8KM\n\tR0Asmkjq8Cn8qMC8LP8LNYKEjvDyUd/laoF1b7lNGSDFgYt+eXmKJ5xS605RRZxJK1\n\tFpV1200f0zwva06Mjp/YH0dAK9ZCRTs9nSZsUC6mCf2xit/XBBUo+npF9G07Fjtd2e\n\tIw5mf7cnD4mtpKq9JWYSEs83N9hvrmhB3DnbDcajEI81v/ijBTHbBLaOZoGpISbnmE\n\t+NEtwvqD35meQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1681986130;\n\tbh=/4jPma8DzdV+OKCwwIO5ZReCOQN6/9Li36bic45tYTg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=V+l94Pv07sKmtfgwbDTGRpW62WWa7YOMTPTeTtkhd52GABIFFTBNvTCkNvSpiO8AM\n\tWfbQa6oLY7PmDrAEevIS1TgOHEWZ5RQBixsE7tHaI+Vdck/KwiFeDoJ1t83rS4RWyx\n\tJfvYRBzp3IT6Dvh8HjePWnvi0+F0l4dURrxu7tqo="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"V+l94Pv0\"; dkim-atps=neutral","Date":"Thu, 20 Apr 2023 13:22:30 +0300","To":"Mattijs Korpershoek <mkorpershoek@baylibre.com>","Message-ID":"<20230420102230.GA11005@pendragon.ideasonboard.com>","References":"<20230404-guard-idmap-v2-0-444d135b3895@baylibre.com>\n\t<20230404-guard-idmap-v2-2-444d135b3895@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230404-guard-idmap-v2-2-444d135b3895@baylibre.com>","Subject":"Re: [libcamera-devel] [PATCH v2 2/2] test: controls:\n\tcontrol_info_map: Test default constructor","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":26916,"web_url":"https://patchwork.libcamera.org/comment/26916/","msgid":"<168198762684.2445904.6386267759102065258@Monstersaurus>","date":"2023-04-20T10:47:06","subject":"Re: [libcamera-devel] [PATCH v2 2/2] test: controls:\n\tcontrol_info_map: Test default constructor","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Laurent,\n\nQuoting Laurent Pinchart via libcamera-devel (2023-04-20 11:22:30)\n> Hello Mattijs,\n> \n> Thank you for the patch.\n> \n> On Wed, Apr 05, 2023 at 10:14:31AM +0200, Mattijs Korpershoek wrote:\n> > ControlInfoMap can be default-constructed. In that case, some of its\n> > members (like idmap_) can be a nullptr, and ControlInfoMap.find() will segfault.\n> \n> Not anymore with patch 1/2 :-) It's however best to add the test first,\n> to verify it fails, and then the fix, to verify it fixes the problem.\n> With patch 1/2 and 2/2 swapped, I would phrase the commit message of\n> this patch as\n> \n> --------\n> ControlInfoMap can be default-constructed. In that case, some of its\n> members (like idmap_) can be a nullptr. Add a test to ensure that the\n> find() function doesn't segfault.\n> \n> The test is expected to fail, the issue will be fixed by a subsequent\n> commit.\n> --------\n\nSorry I have merged this series already - just about the time you wrote\nyour review.\n\n--\nKieran\n\n\n> \n> > Add a test with a default constructed ControlInfoMap to cover this.\n> > \n> > Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>\n> > ---\n> >  test/controls/control_info_map.cpp | 7 +++++++\n> >  1 file changed, 7 insertions(+)\n> > \n> > diff --git a/test/controls/control_info_map.cpp b/test/controls/control_info_map.cpp\n> > index db95945a1580..29b33515e48c 100644\n> > --- a/test/controls/control_info_map.cpp\n> > +++ b/test/controls/control_info_map.cpp\n> > @@ -75,6 +75,13 @@ protected:\n> >                       return TestFail;\n> >               }\n> >  \n> > +             /* Test looking up a control on a default-constructed infoMap */\n> \n> s/infoMap/infoMap./\n> \n> With this,\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> > +             const ControlInfoMap emptyInfoMap;\n> > +             if (emptyInfoMap.find(12345) != emptyInfoMap.end()) {\n> > +                     cerr << \"find() on empty ControlInfoMap failed\" << endl;\n> > +                     return TestFail;\n> > +             }\n> > +\n> >               return TestPass;\n> >       }\n> >  };\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","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 43793BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 20 Apr 2023 10:47:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A8E3B603A2;\n\tThu, 20 Apr 2023 12:47:11 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 386B0603A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 20 Apr 2023 12:47:10 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 78CAE1257;\n\tThu, 20 Apr 2023 12:47:02 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681987631;\n\tbh=EI8OlliprEYyjE/GjL5LG4or8jMe8V9QodIsfFZMgg8=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=zr+TLV+Tfw2f/XCS9cUd/7aTkcWI4AKV+e7929skQcusbHcbBBJk+pEEP5AnK1ALC\n\tns+o2GDp7n99qrBLzX7fA3SJgoe+BvWtRfVTLNpUEURkkR72tbKi/EyyiYA9vgQmiJ\n\tThDLkc1vc/ms4P3dEVOIA7nPZ6b4L1DACY78+sxcaS+n1ygkCSco7fzSmnTGngur7y\n\tlToIC9vbdxF+SLBcJz0BdJoGHuKVMwEh5hyEh9TyzpM6pEEt0UNCk9ZjbqIIAQwzAd\n\tq/QnhYuTFLvqtfKzjwk2hZJxvUoBf8hm56qOMT3uQfhorr4yHpeICXbnIg8//sFT8D\n\tWX3fwCncB1f1Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1681987622;\n\tbh=EI8OlliprEYyjE/GjL5LG4or8jMe8V9QodIsfFZMgg8=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=H+pms3peD6QQwGIy7tLEq7NsxmDZ17kYlwO886hsJDZk33UkmjiHUxemZJpWqWuyx\n\tZzEWAuZjXRtvBG809Can5WsV4SF4WV2GL6+pZ08O7UV6du9HewCDLfpU+AE5OiTOZ/\n\tM6isTWZdkl8bOU0T9MvJu9b9hraZHjsd3Raxeu9A="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"H+pms3pe\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20230420102230.GA11005@pendragon.ideasonboard.com>","References":"<20230404-guard-idmap-v2-0-444d135b3895@baylibre.com>\n\t<20230404-guard-idmap-v2-2-444d135b3895@baylibre.com>\n\t<20230420102230.GA11005@pendragon.ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tLaurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>, \n\tMattijs Korpershoek <mkorpershoek@baylibre.com>","Date":"Thu, 20 Apr 2023 11:47:06 +0100","Message-ID":"<168198762684.2445904.6386267759102065258@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v2 2/2] test: controls:\n\tcontrol_info_map: Test default constructor","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]