Patch Detail
Show a patch.
GET /api/patches/18191/?format=api
{ "id": 18191, "url": "https://patchwork.libcamera.org/api/patches/18191/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18191/", "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": "<20230124092218.2266563-1-raj.khem@gmail.com>", "date": "2023-01-24T09:22:18", "name": "[libcamera-devel] file_sink.cpp: Avoid dangling-reference", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "99eff71607e4ec8b6844750740f92c0b7b2bf741", "submitter": { "id": 62, "url": "https://patchwork.libcamera.org/api/people/62/?format=api", "name": "Khem Raj", "email": "raj.khem@gmail.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18191/mbox/", "series": [ { "id": 3721, "url": "https://patchwork.libcamera.org/api/series/3721/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3721", "date": "2023-01-24T09:22:18", "name": "[libcamera-devel] file_sink.cpp: Avoid dangling-reference", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3721/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18191/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18191/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 5932DBEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 24 Jan 2023 09:22:25 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BBACB625E4;\n\tTue, 24 Jan 2023 10:22:24 +0100 (CET)", "from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com\n\t[IPv6:2607:f8b0:4864:20::1035])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0843661EFB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Jan 2023 10:22:23 +0100 (CET)", "by mail-pj1-x1035.google.com with SMTP id 88so2654182pjo.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Jan 2023 01:22:22 -0800 (PST)", "from apollo.hsd1.ca.comcast.net ([2601:646:9181:1cf0::aee3])\n\tby smtp.gmail.com with ESMTPSA id\n\tja5-20020a170902efc500b001930b189b32sm1158704plb.189.2023.01.24.01.22.20\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 24 Jan 2023 01:22:20 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674552144;\n\tbh=v3c6njVfwtlIJfD0wnW9qB5Y1EDIlxfasPoKvOlB3kI=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:Cc:From;\n\tb=Ru4tT6i2SO4/WsTHpx9/p1NPtOJaOMlkQwNq/eqS6DeydW45SalOkvXLU+h4E/I8p\n\tQxFogx5acqoVVenRhs9su1pEYshJZkii9/ai6gQe3plsiau4Pf7QVY+wgCH4lmgKzi\n\twikmX9+Jr/FNc4If7/xxhgU+e8oVNn8OZKULuX22NGMinY4eWTHoSNGNc2WWbK+2p6\n\tFI0UXs15959NzBjQa1XXfJIydHtQsp0RKHd7eSC4BlHzMC0ws2t5CeiXWnpOCs1cUc\n\tWkD1kPxQ/VYemedox+hQOaha6CFwLsDDw7e2lE/t6NySdXMfju+hwkNtkgwmq533E9\n\tBCvsLKK8m5aSw==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=UGO1p7cRJGXzq3kZicwAwGHaQBMcEaXKGKPBXC3cWYw=;\n\tb=DLMP4yOPT+CM+S7q05Yl6C27/punfOyxVWjMNC0vlds5mMl9kCD9OyAj6wnBMuT+hV\n\tkL8LUgjpMP8wTzZv5nGj0kuc2juP6tGP9MsXpC+4wEBQgENu446CxfF/4qw1cDSGmR9M\n\tLaY1kK0d4+yJsRaTO6ey85TGCAe/au3oMRmNSP/RrI1y6E0LovT8w9Y56EdUrkyCCZne\n\tOm2V2cl8gVvd/w7AUPTN0FmCqz50PsCVCMFjtCayHyLGDmUQ0iVg5epZWOE1kIoXuzu1\n\tXHcexy86nG14ncAUtEPBb2G+qyMJneOFENvFKPQ7M1x1cTQkFqufeci07soyoCzjfCQ5\n\tNTJA==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"DLMP4yOP\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=UGO1p7cRJGXzq3kZicwAwGHaQBMcEaXKGKPBXC3cWYw=;\n\tb=mXZ9x8pXhpIWScUsO4VmbyoaMQx5p/Cg47eM2e9lEe+5rayPDDpNdm0O1+QxR/8A4P\n\tPTm5dvxO1EafSoQ8eZNH5f3SXbWrnPSZIriBEvsw5H/meL4qG8zaTOxZq8wCBGANsU4R\n\tzuJt+Qi6zCNTuROEG6ZuIiMED8qKN7K9Qv5URJpbbEOyZ31YJJigFcjJAaNj7CIuwjTg\n\t3oW8FfqVW1EP6n0hdPSdxREdOmXZ9EM+VJAeNMfxvBXGBnnjn5SOZ1grG5AyQ8lr5LgI\n\tGpJRZ7QZ58WFtqWeqy5N+LnuCGYD/4vseWAqrueDAJ2MapPlT0f7Pqbu42GhQk6/BCti\n\tuHbw==", "X-Gm-Message-State": "AFqh2kpZnvaR4sk9XFkoEsQDiB+PpIeZ2WLMVuSsPKAYcs3sxIjkrYrD\n\t/Y6UNn7Pspe8/e7VC7pg0b0k+40q/vJo+g==", "X-Google-Smtp-Source": "AMrXdXudx4aXVIiI673iK870hzAfMbpDubRy5yE1sDXNuW6m7jD1UteEKp3zkX2SA6SjAATo528ATA==", "X-Received": "by 2002:a17:903:11cc:b0:194:df47:2b43 with SMTP id\n\tq12-20020a17090311cc00b00194df472b43mr20754401plh.64.1674552140958; \n\tTue, 24 Jan 2023 01:22:20 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 24 Jan 2023 01:22:18 -0800", "Message-Id": "<20230124092218.2266563-1-raj.khem@gmail.com>", "X-Mailer": "git-send-email 2.39.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] file_sink.cpp: Avoid dangling-reference", "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": "Khem Raj via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Khem Raj <raj.khem@gmail.com>", "Cc": "Khem Raj <raj.khem@gmail.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Fixes following errors with gcc-13\n\n../git/src/cam/file_sink.cpp:92:45: error: possibly dangling reference to a temporary [-Werror=dangling-reference]\n 92 | const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n | ^~~~\n../git/src/cam/file_sink.cpp:92:81: note: the temporary was destroyed at the end of the full expression '(& buffer->libcamera::FrameBuffer::metadata())->libcamera::FrameMetadata::planes().libcamera::Span<const libcamera::FrameMetadata::Plane>::operator[](i)'\n 92 | const FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n | ^\ncc1plus: all warnings being treated as errors\n\nSigned-off-by: Khem Raj <raj.khem@gmail.com>\n---\n src/cam/file_sink.cpp | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)", "diff": "diff --git a/src/cam/file_sink.cpp b/src/cam/file_sink.cpp\nindex 45213d4a..897c4b37 100644\n--- a/src/cam/file_sink.cpp\n+++ b/src/cam/file_sink.cpp\n@@ -89,13 +89,13 @@ void FileSink::writeBuffer(const Stream *stream, FrameBuffer *buffer)\n \tImage *image = mappedBuffers_[buffer].get();\n \n \tfor (unsigned int i = 0; i < buffer->planes().size(); ++i) {\n-\t\tconst FrameMetadata::Plane &meta = buffer->metadata().planes()[i];\n+\t\tunsigned int bytesused = buffer->metadata().planes()[i].bytesused;\n \n \t\tSpan<uint8_t> data = image->data(i);\n-\t\tunsigned int length = std::min<unsigned int>(meta.bytesused, data.size());\n+\t\tunsigned int length = std::min<unsigned int>(bytesused, data.size());\n \n-\t\tif (meta.bytesused > data.size())\n-\t\t\tstd::cerr << \"payload size \" << meta.bytesused\n+\t\tif (bytesused > data.size())\n+\t\t\tstd::cerr << \"payload size \" << bytesused\n \t\t\t\t << \" larger than plane size \" << data.size()\n \t\t\t\t << std::endl;\n \n", "prefixes": [ "libcamera-devel" ] }