{"id":11838,"url":"https://patchwork.libcamera.org/api/patches/11838/?format=json","web_url":"https://patchwork.libcamera.org/patch/11838/","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":"<20210405040424.1929737-3-hiroh@chromium.org>","date":"2021-04-05T04:04:24","name":"[libcamera-devel,2/2] android: CameraDevice: Validate buffer_handle by CameraBuffer::isValid()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"306c55030d4323d04de2a7e2c891dbf32221db70","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11838/mbox/","series":[{"id":1892,"url":"https://patchwork.libcamera.org/api/series/1892/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1892","date":"2021-04-05T04:04:22","name":"Check a buffer validness by CameraBuffer::IsValid()","version":1,"mbox":"https://patchwork.libcamera.org/series/1892/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11838/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11838/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 DE5ABBD695\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Apr 2021 04:04:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9BCAC68783;\n\tMon,  5 Apr 2021 06:04:39 +0200 (CEST)","from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com\n\t[IPv6:2607:f8b0:4864:20::1030])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6CB7468783\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Apr 2021 06:04:37 +0200 (CEST)","by mail-pj1-x1030.google.com with SMTP id\n\tf2-20020a17090a4a82b02900c67bf8dc69so7232576pjh.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 04 Apr 2021 21:04:37 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:2581:afba:2075:466f])\n\tby smtp.gmail.com with ESMTPSA id\n\tbb16sm7543783pjb.17.2021.04.04.21.04.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSun, 04 Apr 2021 21:04:35 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"ZXelNUSs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=ioGqGKyDg6AOPNWzJo4tzO6VhLhGKaeK7IlLaRXe6fE=;\n\tb=ZXelNUSsZrkojiCsTvzI5C2VoI312mXjY8pgFmu/32FvmaVrnnARgJ+BETI58HYawQ\n\tQ7e/kXwQTAU+JwSWPJi1f9+4emfzCWuU/swpRRW975NR7nm37hAI+ldR2VK3HEGYWj/z\n\tmu/cFsMtj22HlGmoXWeH809LMR9225ejqowK8=","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:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=ioGqGKyDg6AOPNWzJo4tzO6VhLhGKaeK7IlLaRXe6fE=;\n\tb=jdSl2ChFG/345u2TNqy9W7lVO2OJ+VR2x/BZEst+IyNUhoQJLdFrgf7E3bbHAr5hrx\n\tzClMYbjBasULgfv5JqBftY/DBsySPtxgO6TrziLCVvQk20DGINQb6+7BMIopUnMXrHHW\n\tGRZpKzvvFkSfnkoXWJeieXd2psV6eOTGqdFl9koUw3gUyy72z1hKk7zf3OUrILJRHD6V\n\tpFrKIBensbrQCIVukWtI7HsHvglZ8sEi4pVOoYkdJ0gDygXEDj+cQYoqllvVho08pzQk\n\t7srG8Ez0qZw8vK2kDCq0ZaU9enYI1WpJgJm+EEAXTIC2j7ZQlmlUOB2lyX7X1WkbdmeZ\n\t3hdQ==","X-Gm-Message-State":"AOAM533jVmectdlNNKceC/AvbxJrpEdJWUiGu/lM68uWw9hv9IIFD404\n\tbWcCwTFWzhGca3FuWPplbcUnWutuDcrqRw==","X-Google-Smtp-Source":"ABdhPJzxL88fIfZzctyOl3/tU1ONKxMHKT8GJM8hYZYIQ7QGnrn60WTUteDotBA3fM1/e5RIextgIw==","X-Received":"by 2002:a17:902:8a83:b029:e7:1029:8ddc with SMTP id\n\tp3-20020a1709028a83b02900e710298ddcmr22589290plo.2.1617595475367; \n\tSun, 04 Apr 2021 21:04:35 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  5 Apr 2021 13:04:24 +0900","Message-Id":"<20210405040424.1929737-3-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.0.208.g409f899ff0-goog","In-Reply-To":"<20210405040424.1929737-1-hiroh@chromium.org>","References":"<20210405040424.1929737-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 2/2] android: CameraDevice: Validate\n\tbuffer_handle by CameraBuffer::isValid()","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"This adds a validation to buffer_handle provided in\nCameraDevice::processCaptureRequest() by using\nCameraBuffer::isValid().\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp | 8 ++++++++\n 1 file changed, 8 insertions(+)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 89044efa..0fff5927 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -257,6 +257,7 @@ void sortCamera3StreamConfigs(std::vector<Camera3StreamConfig> &unsortedConfigs,\n }\n \n bool isValidRequest(camera3_capture_request_t *camera3Request)\n+\n {\n \tif (!camera3Request) {\n \t\tLOG(HAL, Error) << \"No capture request provided\";\n@@ -293,6 +294,13 @@ bool isValidRequest(camera3_capture_request_t *camera3Request)\n \t\t\t\t<< \") in buffer \" << i;\n \t\t\treturn false;\n \t\t}\n+\n+\t\tCameraBuffer cameraBuffer(*outputBuffer.buffer,\n+\t\t\t\t\t  PROT_READ | PROT_WRITE, /*map=*/false);\n+\t\tif (!cameraBuffer.isValid()) {\n+\t\t\tLOG(HAL, Error) << \"cameraBuffer is invalid\";\n+\t\t\treturn false;\n+\t\t}\n \t}\n \n \treturn true;\n","prefixes":["libcamera-devel","2/2"]}