Show a patch.

GET /api/patches/14025/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 14025,
    "url": "https://patchwork.libcamera.org/api/patches/14025/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14025/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20211001211525.1423725-1-javierm@redhat.com>",
    "date": "2021-10-01T21:15:24",
    "name": "[libcamera-devel,v2,1/2] gstreamer: Check if Stream configurations were generated correctly",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "bfedef371f658f4306def156b8c51691a07b3a21",
    "submitter": {
        "id": 95,
        "url": "https://patchwork.libcamera.org/api/people/95/?format=api",
        "name": "Javier Martinez Canillas",
        "email": "javierm@redhat.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/14025/mbox/",
    "series": [
        {
            "id": 2591,
            "url": "https://patchwork.libcamera.org/api/series/2591/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2591",
            "date": "2021-10-01T21:15:24",
            "name": "[libcamera-devel,v2,1/2] gstreamer: Check if Stream configurations were generated correctly",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2591/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14025/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14025/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 BC754BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  1 Oct 2021 21:15:58 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1BDAD691AD;\n\tFri,  1 Oct 2021 23:15:58 +0200 (CEST)",
            "from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [216.205.24.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 43B85691A6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  1 Oct 2021 23:15:56 +0200 (CEST)",
            "from mail-wr1-f71.google.com (mail-wr1-f71.google.com\n\t[209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id\n\tus-mta-559-PSFG3O8bMsW3V6fyrxZyiQ-1; Fri, 01 Oct 2021 17:15:53 -0400",
            "by mail-wr1-f71.google.com with SMTP id\n\tl9-20020adfc789000000b00160111fd4e8so3175039wrg.17\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 01 Oct 2021 14:15:53 -0700 (PDT)",
            "from minerva.home ([92.176.231.106])\n\tby smtp.gmail.com with ESMTPSA id\n\ty11sm8242871wrg.18.2021.10.01.14.15.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 01 Oct 2021 14:15:51 -0700 (PDT)"
        ],
        "Authentication-Results": [
            "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"IAJsQyG2\"; dkim-atps=neutral",
            "relay.mimecast.com;\n\tauth=pass smtp.auth=CUSA124A263 smtp.mailfrom=javierm@redhat.com"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1633122954;\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\tbh=wm2Vp1tx9fNpntsIKsWCljZ3E5VHReP1nyy2Rk2Rf9w=;\n\tb=IAJsQyG2ObUthFPqfyPyybt66CrwDsyjCxI21ayBSXsYhctmi0RUbQdxZb2V+5bIKEziCe\n\t9OGekrxYOnWO/mKxyiYVOuN/8LYfPQqyMpAtSazJAyLnzBo55C+C9+g4TiCNKQRrs+XJAl\n\t7Er3vb9vQT+pit61d9zVU5X9nKzjaaw=",
        "X-MC-Unique": "PSFG3O8bMsW3V6fyrxZyiQ-1",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=wm2Vp1tx9fNpntsIKsWCljZ3E5VHReP1nyy2Rk2Rf9w=;\n\tb=zFK7BV0oqVVEMaffGwucHNPQ5O88gBzE7dGcOzZlSEQQPdmI6y87MW57pPzzjyu3P/\n\tA1/niIbhavoVuRII8zUmpfr406XMPEmJwxyi9Lg/wU6UE4ExOqhRV8/eGCiFjKvPjHcr\n\tsOV/f9+ZGxPrM7Br34ewzA+Rn3KNbKLm1aVtxjhC3fDnACfzJCbyo8SpEjb71Rip8vtw\n\tBdzc0OG2Rpj08ArV9lC01wkXx5sQaDF7iHN/eYWNAWmJabrwGyAnZudv9bQH97dehyaN\n\tY1M2639zImnYQqY7tJwxWEWFKwsw6bZl1DNP0d6Vr8puFumZT4pxgmAOMdec0brs4cqq\n\tEPqg==",
        "X-Gm-Message-State": "AOAM530DzPrEXva48XwIjaXiisSGd8EBKu9ORzD3yTKmMWIZe5TA+0kH\n\tLKtTHV5X6E9r7516oXYOIigigDDr4JFDJOHXbm3tdH836iIW0gB6N2rOjuiXammgJC9lEe+Xo8Y\n\t22fG9RKCtNcD/YsS2d4q4B/HEcckfwgA9WqB/mpWmDCIOT7ONEjHBFxsdyKs/Cg6kOXRV5XsDXY\n\t0OzF7lLzUs",
        "X-Received": [
            "by 2002:adf:a3d9:: with SMTP id m25mr139708wrb.27.1633122952272; \n\tFri, 01 Oct 2021 14:15:52 -0700 (PDT)",
            "by 2002:adf:a3d9:: with SMTP id m25mr139689wrb.27.1633122951937; \n\tFri, 01 Oct 2021 14:15:51 -0700 (PDT)"
        ],
        "X-Google-Smtp-Source": "ABdhPJwJwdZojpU0QnBHFFrAXt8q5NI+Zp/Wy4ypjvSVQNCgm20VHX13edLJ5FC/tWoQAcfUcoZycw==",
        "From": "Javier Martinez Canillas <javierm@redhat.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  1 Oct 2021 23:15:24 +0200",
        "Message-Id": "<20211001211525.1423725-1-javierm@redhat.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "MIME-Version": "1.0",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"",
        "Subject": "[libcamera-devel] [PATCH v2 1/2] gstreamer: Check if Stream\n\tconfigurations were generated correctly",
        "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": "Nicolas Dufresne <nicolas.dufresne@collabora.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Currently, the gst_libcamera_device_new() function assumes that a call to\nCamera::generateConfiguration() will always succeed, but that may not be\nthe case and the return value must to be checked.\n\nOtherwise, this could lead to a NULL pointer dereference if the pipeline\nhandler fails to generate a config for the VideoRecording stream role.\n\nSigned-off-by: Javier Martinez Canillas <javierm@redhat.com>\nReviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n---\n\nChanges in v2:\n- Fix typos in commit message as pointed out by Nicolas Dufresne.\n- Add Nicolas Dufresne's Reviewed-by tag.\n\n src/gstreamer/gstlibcameraprovider.cpp | 14 +++++++++++++-\n 1 file changed, 13 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/gstreamer/gstlibcameraprovider.cpp b/src/gstreamer/gstlibcameraprovider.cpp\nindex aee6f9a2be2..6eb0a0eb0c4 100644\n--- a/src/gstreamer/gstlibcameraprovider.cpp\n+++ b/src/gstreamer/gstlibcameraprovider.cpp\n@@ -132,6 +132,10 @@ gst_libcamera_device_new(const std::shared_ptr<Camera> &camera)\n \n \troles.push_back(StreamRole::VideoRecording);\n \tstd::unique_ptr<CameraConfiguration> config = camera->generateConfiguration(roles);\n+\tif (!config || config->size() != roles.size()) {\n+\t\tGST_ERROR(\"Failed to generate a default configuration for %s\", name);\n+\t\treturn nullptr;\n+\t}\n \n \tfor (const StreamConfiguration &stream_cfg : *config) {\n \t\tGstCaps *sub_caps = gst_libcamera_stream_formats_to_caps(stream_cfg.formats());\n@@ -189,8 +193,16 @@ gst_libcamera_provider_probe(GstDeviceProvider *provider)\n \n \tfor (const std::shared_ptr<Camera> &camera : cm->cameras()) {\n \t\tGST_INFO_OBJECT(self, \"Found camera '%s'\", camera->id().c_str());\n+\n+\t\tGstDevice *dev = gst_libcamera_device_new(camera);\n+\t\tif (!dev) {\n+\t\t\tGST_ERROR_OBJECT(self, \"Failed to add camera '%s'\",\n+\t\t\t\t\t camera->id().c_str());\n+\t\t\treturn nullptr;\n+\t\t}\n+\n \t\tdevices = g_list_append(devices,\n-\t\t\t\t\tg_object_ref_sink(gst_libcamera_device_new(camera)));\n+\t\t\t\t\tg_object_ref_sink(dev));\n \t}\n \n \treturn devices;\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "1/2"
    ]
}