From patchwork Wed Apr 7 04:36:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11856 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 75184BD695 for ; Wed, 7 Apr 2021 04:36:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 35FC0687DB; Wed, 7 Apr 2021 06:36:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="m952RnXo"; dkim-atps=neutral Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7174E6879F for ; Wed, 7 Apr 2021 06:36:29 +0200 (CEST) Received: by mail-pj1-x1034.google.com with SMTP id z22-20020a17090a0156b029014d4056663fso650530pje.0 for ; Tue, 06 Apr 2021 21:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n5Yvb32OqZp+I0yt8WUj7KhqsNdr2yErjMwK5nk0/0g=; b=m952RnXobrALknJWLZwwAJ4zFXd9WXAfGr3AMdVWnD0HcTB6JEr2N5mlivow7KqRGt dQ8HZT3HqPZ61SKdN/fCNAlSlf7eJmI/xNDeOxRqhAMOea8S2Quu90HqXC6GdsbuHOWJ GxxgNH47qMM0qwghGHKZXnlt7YHIsURaLP/4Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n5Yvb32OqZp+I0yt8WUj7KhqsNdr2yErjMwK5nk0/0g=; b=Hl6ybK4jPcYJk4E+QBeIQXe3RkrW0YrHCxSpv5H1pJUbF1j5hxhEG+vGFQ/LK4ONsR 5RSqwqhEQPWFiP5R408LcZPmjS1TMFLZm49sZUcVcS1Gai/o1InKfPav5iC+e9gy1Psi rTSSM9PFCGNRmKxVxk7yheKeZFfXbSALetXAhmU6AwIrwwgUwEyvZARnXUq8JNuVu1eZ Ogr4jOpCA7UOmuBlbrjoMmHmk4noYcqH9/AtTzWA1azD60krqDgcbXfxBmeNr0EJm0Hs m6oLY6dtLnLLtMKaQ1q658jfNTAu7wlI/L2YtOKVOf1XkXjLrf9GSX+uVmDberZB8lh8 GLIQ== X-Gm-Message-State: AOAM5332AUVRvqzRfVtxe9BZKlDOrfxHuZr2gZaJrxg+Vtv1/Nhy7jt6 ojhTBesxeK4R+WfXFITLJ8OJpo/eU1yplA== X-Google-Smtp-Source: ABdhPJxIlvVFjqzFuAXSAWSI90VFywswpJVg7qWPhSMa6Qh3CTVU26IAyZqIprfjjIvG2mT3127Sog== X-Received: by 2002:a17:90a:6343:: with SMTP id v3mr1438562pjs.153.1617770187644; Tue, 06 Apr 2021 21:36:27 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:4180:40db:6f79:a143]) by smtp.gmail.com with ESMTPSA id d2sm19466967pgp.47.2021.04.06.21.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 21:36:27 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Wed, 7 Apr 2021 13:36:20 +0900 Message-Id: <20210407043620.1756347-2-hiroh@chromium.org> X-Mailer: git-send-email 2.31.0.208.g409f899ff0-goog In-Reply-To: <20210407043620.1756347-1-hiroh@chromium.org> References: <20210407043620.1756347-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/2] android: CameraDevice: Validate buffer_handle by CameraBuffer::isValidBuffer() X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This adds a validation to buffer_handle provided in CameraDevice::processCaptureRequest() by using CameraBuffer::isValidBuffer(). Signed-off-by: Hirokazu Honda Reviewed-by: Jacopo Mondi --- src/android/camera_device.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 89044efa..8a742812 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -293,6 +293,11 @@ bool isValidRequest(camera3_capture_request_t *camera3Request) << ") in buffer " << i; return false; } + + if (!CameraBuffer::isValidBuffer(handle)) { + LOG(HAL, Error) << "buffer " << i << "is invalid"; + return false; + } } return true;