Patch Detail
Show a patch.
GET /api/patches/19004/?format=api
{ "id": 19004, "url": "https://patchwork.libcamera.org/api/patches/19004/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19004/", "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": "<20230914092756.31516-1-naush@raspberrypi.com>", "date": "2023-09-14T09:27:56", "name": "[libcamera-devel] ipa: rpi: Fix segfault when parsing invalid json file", "commit_ref": "90e0fea6c6ba6294bf9438d37d74676cc53ef924", "pull_url": null, "state": "accepted", "archived": false, "hash": "2bfb3c3f869f4024aed67dac502d903fa711ccce", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19004/mbox/", "series": [ { "id": 4021, "url": "https://patchwork.libcamera.org/api/series/4021/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4021", "date": "2023-09-14T09:27:56", "name": "[libcamera-devel] ipa: rpi: Fix segfault when parsing invalid json file", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4021/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19004/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19004/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 8D326BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 14 Sep 2023 09:28:40 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8DDA162900;\n\tThu, 14 Sep 2023 11:28:39 +0200 (CEST)", "from mail-lj1-x229.google.com (mail-lj1-x229.google.com\n\t[IPv6:2a00:1450:4864:20::229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 954FE628E9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 14 Sep 2023 11:28:37 +0200 (CEST)", "by mail-lj1-x229.google.com with SMTP id\n\t38308e7fff4ca-2bd0d135ca3so11331541fa.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 14 Sep 2023 02:28:37 -0700 (PDT)", "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tf20-20020a7bcd14000000b003fe2b6d64c8sm4268849wmj.21.2023.09.14.02.28.35\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 14 Sep 2023 02:28:35 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1694683719;\n\tbh=BQ3orsXtjyytLL4kkTSY6sqs8qQDJT3TAWNcm9HyoxI=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=P9ofEE9uPh6nEFcEw9QNlx4u+EGy0ptW1SwbY9lD8/eUpGgIKBbybBAqKdyEgB/Xs\n\t7a5tF+ACJjsE1AimN1lkutJ5JnEQ/+VtaVj2+1TKa9H6w9ODkNLB/dg/dF4oRkcu/V\n\tHpd/2owpFiSoiG/dJhvwA3fjdfd4fKEDrob5H640rDi9m60DsaMvPfMDMvGFNiRMvm\n\tJObJEmBD6bMJEyV+apEr5oyOYI/MhqO39pwgM5grkD5HbwNfoDIufsWnJBWOYo9IIC\n\td2oer7NiXQ7sKayaySZ6ZfcdGyfAEU5JR8T0kjxp0RfpSuzVbCNZNrLySW6+iSvw2K\n\tO+M5KxZqDmHLw==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1694683716; x=1695288516;\n\tdarn=lists.libcamera.org; \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=G0zu+/96v9V4RFdf5Ray1Vtuuivsb3Sgh2IjVypzuJQ=;\n\tb=Jr9clZYbOBmt4M0NSHrGp/TSLJTTLo2nM9SqrlC6Y0m9KcJOqaWzB5r5dNph66QLWC\n\thQXISSkqqZ3Ar5GrsDxV7XyKKFV5x468LpEVScMFyEzI3NUfRJHjWO+bMSuSf0tc1i4i\n\tz0Reku1CTbkFCW/oVvXVV0NCp3vzAF+ywHMw0Ni9quyo85Rv2w848Asjg5f5mvi4A4ca\n\t8iw/uNwyr2cMQcdgCO2mGVgP6CSi+WA1/EmVzqfaT5+mGzqWr4Uixd6vHb1Ckx6BFnNB\n\tWB0ijPHM0tCRO/ahfmYfNYWvRgjDZ/IOfYei/jU/1F1woT7587PFiWB+iryJMmVSwoHX\n\tkvzA==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"Jr9clZYb\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1694683716; x=1695288516;\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=G0zu+/96v9V4RFdf5Ray1Vtuuivsb3Sgh2IjVypzuJQ=;\n\tb=kAW6QIRcWdaRnKbFftQ2jb2B4iL+tpxyR+faUdoA2ZeGIPBeE/oBsh76wIzVhCgepu\n\t2MZSXVGo8MDJCjOZpxjs7l3b5G1rsJRVl900KosulvWsncSDg6XGZC1DJ6UaHDHnzMog\n\t+6KY4ydWiqddpWYgzbASFgRXtNNVye0oj01NP+dMH6uYL+lc8F85sPJhqm1ID8L7akmD\n\tFTOJHGnVWMn1BLNIquFRfl+YG7Xt6TvcKS89/RL5DNY4TJq2xy/dq3rFgGBG8zhd5C5m\n\t8125QvykPneV6qYUqPbkuym/AZssOVxJqALfvbIsekKupn67JlINoMAo72dbKIrJT5b6\n\tOE4A==", "X-Gm-Message-State": "AOJu0YxNrkNfp1sPlLlVwa0Vo6M1zqlf3UzBb3Fcm8GD4A7/BeQJfhFJ\n\tpMXfd3blKyq2yHJtrS0fo/nERpuXxU83t9i+PJCKHA==", "X-Google-Smtp-Source": "AGHT+IG/ITvIffqOHBZaC/VhlkuLzNIl2PK7TdC36vr9JMVmN9NyG/8d8fN3gCN1hOME/M+sBs1ZHQ==", "X-Received": "by 2002:a2e:a3d7:0:b0:2b9:c046:8617 with SMTP id\n\tw23-20020a2ea3d7000000b002b9c0468617mr3861995lje.5.1694683716318; \n\tThu, 14 Sep 2023 02:28:36 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 14 Sep 2023 10:27:56 +0100", "Message-Id": "<20230914092756.31516-1-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.34.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] ipa: rpi: Fix segfault when parsing\n\tinvalid json file", "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": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Naushir Patuck <naush@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "If the json file parsing failed due to a malformed file, the root\npointer would be null. This was not tested and caused a segfault when\ntrying to use the pointer to retrive the version key.\n\nFix this by bailing out early if the parser returns a null pointer.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/controller/controller.cpp | 3 +++\n 1 file changed, 3 insertions(+)", "diff": "diff --git a/src/ipa/rpi/controller/controller.cpp b/src/ipa/rpi/controller/controller.cpp\nindex fa1721130783..14d245da2ce7 100644\n--- a/src/ipa/rpi/controller/controller.cpp\n+++ b/src/ipa/rpi/controller/controller.cpp\n@@ -56,6 +56,9 @@ int Controller::read(char const *filename)\n \t}\n \n \tstd::unique_ptr<YamlObject> root = YamlParser::parse(file);\n+\tif (!root)\n+\t\treturn -EINVAL;\n+\n \tdouble version = (*root)[\"version\"].get<double>(1.0);\n \ttarget_ = (*root)[\"target\"].get<std::string>(\"bcm2835\");\n \n", "prefixes": [ "libcamera-devel" ] }