{"id":12482,"url":"https://patchwork.libcamera.org/api/patches/12482/?format=json","web_url":"https://patchwork.libcamera.org/patch/12482/","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":"<20210601205640.14334-1-vedantparanjape160201@gmail.com>","date":"2021-06-01T20:56:40","name":"[libcamera-devel,v3] gstreamer: Add error checking in gst_libcamera_src_task_enter()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"0086865ab6b355456d14fbae562a7de215c028b6","submitter":{"id":85,"url":"https://patchwork.libcamera.org/api/people/85/?format=json","name":"Vedant Paranjape","email":"vedantparanjape160201@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12482/mbox/","series":[{"id":2099,"url":"https://patchwork.libcamera.org/api/series/2099/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2099","date":"2021-06-01T20:56:40","name":"[libcamera-devel,v3] gstreamer: Add error checking in gst_libcamera_src_task_enter()","version":3,"mbox":"https://patchwork.libcamera.org/series/2099/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12482/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12482/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 7B913C3206\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  1 Jun 2021 20:57:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E3CE968920;\n\tTue,  1 Jun 2021 22:57:20 +0200 (CEST)","from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com\n\t[IPv6:2607:f8b0:4864:20::42c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 46B5B6891F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  1 Jun 2021 22:57:19 +0200 (CEST)","by mail-pf1-x42c.google.com with SMTP id x73so459022pfc.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 01 Jun 2021 13:57:19 -0700 (PDT)","from localhost.localdomain ([1.186.76.76])\n\tby smtp.googlemail.com with ESMTPSA id\n\th18sm10394038pgl.87.2021.06.01.13.57.15\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 01 Jun 2021 13:57:16 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"p7aJTZV9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=AxoMVPvoCK9eJz8qPA2++Hzla1H7A3U/vm22XPKhKj0=;\n\tb=p7aJTZV9zEUWMFmCfrgJNd0JmkNbhnC6CkF4hFf7HROMc00dy1D09uIPR6nOG+fGqU\n\t6fcb5CSy9IWt0bS/NDVS88Yg/+fRioSXoWBsov1g6tLfqoG4uoRltIdaGxMfPeSfy2M7\n\t8zWeQ85b/HOHAkGAYVO8u01svw7xSE4ymVtrU2nqKXSpc+aa8G0EmEQhHGW0QPc2rRxC\n\teRHZe1b1UcbJ+SdK7Lo3f5cB4bqzGU7KGQPEnxKbrXDieEsYCkl9KTJrLy134FsHP2vB\n\tnBv2FY3F4uYasmjxF/oIB5PuVAQECd4GlU5RFnaTO+qwiGpmsnvJkQ8CdAanbAFGeb3B\n\tqhQw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=AxoMVPvoCK9eJz8qPA2++Hzla1H7A3U/vm22XPKhKj0=;\n\tb=J1XVNQ9EOo+VzJ/s5URd2emjtqpjmwhdsPooZRuA9d5H/8QovOsORLqSEWLUEcPCJB\n\t+IVOZorFiq7nylDp1zdk7NGGdExM7Fs7BsxoRGq8/KtQ57UrMRqvTzCyH7F5ACp6pLD8\n\tfAhNRBxHzGfHN0bQ+tafXcuL0cO6ICBJm7U1lkeNnmxGOBci976oi3XH37BVlBGJkWfH\n\tmPn3Kmk+iWXGcYTSgVi/2AvjJPmZ67m1/APmWIAU4olY+H4h2/Ma86euEQ3sYzr6YsJA\n\tICY+GCPp2EBYSzyeTAr9YfMVLHCttsidF6+udh3nHET2xTVpLaGz/AUQFwY3IcmOfPZx\n\t/Y4w==","X-Gm-Message-State":"AOAM531LY+UU4Oc79U7KOmacjFkoGJlJS+0ltQ6uH6MaLvZD8D45WdyA\n\txWiIitcOb73uFOYTfqVkNfleZRBUgGD8iQ==","X-Google-Smtp-Source":"ABdhPJxgtBS/WFwEvXoTpplr0RUMqKcMEowyOdXPXQknLvYA/8T46AWXEhZNA8r2Js6I0Ho7XA61Hg==","X-Received":"by 2002:a05:6a00:1a8c:b029:2e9:a532:148a with SMTP id\n\te12-20020a056a001a8cb02902e9a532148amr18421719pfv.38.1622581037329; \n\tTue, 01 Jun 2021 13:57:17 -0700 (PDT)","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  2 Jun 2021 02:26:40 +0530","Message-Id":"<20210601205640.14334-1-vedantparanjape160201@gmail.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3] gstreamer: Add error checking in\n\tgst_libcamera_src_task_enter()","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>","Cc":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Error checking the output from generateConfiguration() was missing in\nthe code. Only assert was added as a guard which checked if the size of\ngenerated camera config was equal to size of roles passed to it.\n\nIf the roles argument has a invalid member, it will return a nullptr and then\ntrying to access a member on a nullptr for size comparison will result in a\nsegmentation fault. So, if the function returns a nullptr, it will simply push\nan error message on GstBus and gracefully exit.\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n---\n src/gstreamer/gstlibcamerasrc.cpp | 11 +++++++----\n 1 file changed, 7 insertions(+), 4 deletions(-)","diff":"diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex 87246b40..ccc61590 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -375,10 +375,13 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread,\n \n \t/* Generate the stream configurations, there should be one per pad. */\n \tstate->config_ = state->cam_->generateConfiguration(roles);\n-\t/*\n-\t * \\todo Check if camera may increase or decrease the number of streams\n-\t * regardless of the number of roles.\n-\t */\n+\tif (state->config_ == nullptr) {\n+\t\tGST_ELEMENT_ERROR(self, RESOURCE, SETTINGS,\n+\t\t\t\t  (\"Failed to generate camera configuration from roles\"),\n+\t\t\t\t  (\"Camera::generateConfiguration() returned nullptr\"));\n+\t\tgst_task_stop(task);\n+\t\treturn;\n+\t}\n \tg_assert(state->config_->size() == state->srcpads_.size());\n \n \tfor (gsize i = 0; i < state->srcpads_.size(); i++) {\n","prefixes":["libcamera-devel","v3"]}