Patch Detail
Show a patch.
GET /api/patches/12624/?format=api
{ "id": 12624, "url": "https://patchwork.libcamera.org/api/patches/12624/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12624/", "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": "<20210616234422.24789-1-laurent.pinchart@ideasonboard.com>", "date": "2021-06-16T23:44:22", "name": "[libcamera-devel] libcamera: pipeline: simple: Fix crash when storing timestamp in metadata", "commit_ref": "73b823b22009b87fc1d33a8000a870fe9223e7bb", "pull_url": null, "state": "accepted", "archived": false, "hash": "18cf610cc8c09046140fc5550ab7730d1a95f06f", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/12624/mbox/", "series": [ { "id": 2145, "url": "https://patchwork.libcamera.org/api/series/2145/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2145", "date": "2021-06-16T23:44:22", "name": "[libcamera-devel] libcamera: pipeline: simple: Fix crash when storing timestamp in metadata", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2145/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12624/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12624/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 57874BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 16 Jun 2021 23:45:06 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 670CD68941;\n\tThu, 17 Jun 2021 01:45:05 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7F2C86029D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Jun 2021 01:45:01 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DCD69E53;\n\tThu, 17 Jun 2021 01:45:00 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Ro/pbD+F\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1623887101;\n\tbh=qsvJH/LnPBeVM4aVFfNCSvj8QYxZUlvlCqyEYWN2rSs=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=Ro/pbD+Fmvr02FpnVvP9x+3q7zdf3CmGO2vxRaKzFZ8NyJ9AxZxYGA6UcujATyGZ8\n\tMuM/zbVi8GMXJqsLSBG4dDJdtc/80HIhPcx697PAT5qT9abXMywiT2wV49qlwaC7Ul\n\txb6x1FALTlgyDOr9eXQwUFPO6nkqKm0NNTVradc0=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 17 Jun 2021 02:44:22 +0300", "Message-Id": "<20210616234422.24789-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] libcamera: pipeline: simple: Fix crash\n\twhen storing timestamp in metadata", "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": "Commit 922833f774f6 (\"libcamera: simple: Report sensor timestamp\")\nunconditionally tries to access the request through the capture buffer\nto store the capture timestamp in the metadata. This causes a null\npointer dereference when using a converter, as the capture buffers are\nfree-wheeling in that case, and not associated with a request.\n\nFix this by getting the request from the user-facing buffer, which can\nbe the capture buffer when no converter is used.\n\nFixes: 922833f774f6 (\"libcamera: simple: Report sensor timestamp\")\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/simple/simple.cpp | 20 +++++++++++++++++---\n 1 file changed, 17 insertions(+), 3 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex 36fd9b852b33..e63d0bfd2fcb 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -1127,14 +1127,28 @@ void SimplePipelineHandler::bufferReady(FrameBuffer *buffer)\n \t}\n \n \t/*\n-\t * Record the sensor's timestamp in the request metadata.\n+\t * Record the sensor's timestamp in the request metadata. The request\n+\t * needs to be obtained from the user-facing buffer, as internal\n+\t * buffers are free-wheeling and have no request associated with them.\n \t *\n \t * \\todo The sensor timestamp should be better estimated by connecting\n \t * to the V4L2Device::frameStart signal if the platform provides it.\n \t */\n \tRequest *request = buffer->request();\n-\trequest->metadata().set(controls::SensorTimestamp,\n-\t\t\t\tbuffer->metadata().timestamp);\n+\n+\tif (data->useConverter_ && !data->converterQueue_.empty()) {\n+\t\tconst std::map<unsigned int, FrameBuffer *> &outputs =\n+\t\t\tdata->converterQueue_.front();\n+\t\tif (!outputs.empty()) {\n+\t\t\tFrameBuffer *outputBuffer = outputs.begin()->second;\n+\t\t\tif (outputBuffer)\n+\t\t\t\trequest = outputBuffer->request();\n+\t\t}\n+\t}\n+\n+\tif (request)\n+\t\trequest->metadata().set(controls::SensorTimestamp,\n+\t\t\t\t\tbuffer->metadata().timestamp);\n \n \t/*\n \t * Queue the captured and the request buffer to the converter if format\n", "prefixes": [ "libcamera-devel" ] }