{"id":3614,"url":"https://patchwork.libcamera.org/api/1.1/patches/3614/?format=json","web_url":"https://patchwork.libcamera.org/patch/3614/","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":"<20200430003604.2423018-2-niklas.soderlund@ragnatech.se>","date":"2020-04-30T00:36:00","name":"[libcamera-devel,RFC/PATCH,1/5] qcam: Check that camera can generate configuration from roles","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"84cc640d44d93b86f6424952c80d0eafe4fc6500","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/1.1/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3614/mbox/","series":[{"id":855,"url":"https://patchwork.libcamera.org/api/1.1/series/855/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=855","date":"2020-04-30T00:36:00","name":"qcam: Add RAW capture support","version":1,"mbox":"https://patchwork.libcamera.org/series/855/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3614/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3614/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BCDDA6041C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Apr 2020 02:36:36 +0200 (CEST)","from bismarck.berto.se (p4fca2392.dip0.t-ipconnect.de\n\t[79.202.35.146]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid 8687aed3-8a7a-11ea-89d0-0050569116f7;\n\tThu, 30 Apr 2020 02:35:43 +0200 (CEST)"],"X-Halon-ID":"8687aed3-8a7a-11ea-89d0-0050569116f7","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 30 Apr 2020 02:36:00 +0200","Message-Id":"<20200430003604.2423018-2-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.26.0","In-Reply-To":"<20200430003604.2423018-1-niklas.soderlund@ragnatech.se>","References":"<20200430003604.2423018-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC/PATCH 1/5] qcam: Check that camera can\n\tgenerate configuration from roles","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>","X-List-Received-Date":"Thu, 30 Apr 2020 00:36:37 -0000"},"content":"If the camera can not generate a configuration from the requested roles\nit returns a nullptr which leads to a nullptr dereference. Fix this by\nadding a check that the camera generated a configuration before trying\nto access it.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/qcam/main_window.cpp | 4 ++++\n 1 file changed, 4 insertions(+)","diff":"diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex ee779728fc630da8..b683c2e00d317307 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -293,6 +293,10 @@ int MainWindow::startCapture()\n \n \t/* Configure the camera. */\n \tconfig_ = camera_->generateConfiguration(roles);\n+\tif (!config_) {\n+\t\tqWarning() << \"Failed to generate configuration from roles\";\n+\t\treturn -EINVAL;\n+\t}\n \n \tStreamConfiguration &cfg = config_->at(0);\n \n","prefixes":["libcamera-devel","RFC/PATCH","1/5"]}