From patchwork Thu Apr 8 03:10:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11865 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 411EFBD227 for ; Thu, 8 Apr 2021 03:11:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 34900687F3; Thu, 8 Apr 2021 05:10:59 +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="XWtcvKpy"; dkim-atps=neutral Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C84CB687A2 for ; Thu, 8 Apr 2021 05:10:57 +0200 (CEST) Received: by mail-pj1-x102c.google.com with SMTP id ot17-20020a17090b3b51b0290109c9ac3c34so2350054pjb.4 for ; Wed, 07 Apr 2021 20:10:57 -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=0kB3NhEX2dg7aQOxQ6JiJnUKmNOQIHWM9FgWV5zRdkQ=; b=XWtcvKpyfjyfKigk6YKy/04mweWp8n/G/HkbI5owD3P43jxuJ9cYYcCN46sQKp/v+H cP3ccXcrylxfOsQIRBaXyumO/64kBFm2XqBoL5DcPr6E+0IEBrVHzfUOUBatod7bknf7 e4ZXGWUCc2owP9r53H83OyU65Zpan90GOB5AI= 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=0kB3NhEX2dg7aQOxQ6JiJnUKmNOQIHWM9FgWV5zRdkQ=; b=Cn/SjsWAbUKgatIOL8pKS/yXfQiX9IVHAv8qW+QVlEQVLk0kOemHzXtiEO4v3LKdc8 YvhEqj9xDBQyDZoEyc2ypLCneouNpdNj8MfRO7YI3/BKlkAvDEBRs3pYW78UmkRX9plZ LpUQDd36lIQiUGU2PM01yLPYmLgGthZuvp+4t0SEj0dgYFrpOI2dDWnFLxbwpc3rWTrQ yFEYHWZvX4kDbQsLgDlEeKK4/Z+K16ZJ6iErqo/BWKtjaQmvZBC5leI3u13U5iXW9NzI oUFN1v1rRSORk6ksh2ageXWo1tcCsqVBmcc4rdmYsLJUAjDJ+rlZ+G/bdN3A26rs+0d4 kiYw== X-Gm-Message-State: AOAM531+2aCDCczfs+CYX9TJe8CksGcGceBNjuPCKbZQoGlR718ha3LG yCIMtuRKKMggVkGK6NJjIpK5CuNbbNuc/Q== X-Google-Smtp-Source: ABdhPJxFzh9BUPRNc4b8yJlBYw8rY5df99u0d5msick98Usszz6zRpAMMbjvt5U1kr+kaceY2TqKUg== X-Received: by 2002:a17:90a:b392:: with SMTP id e18mr6207040pjr.66.1617851456246; Wed, 07 Apr 2021 20:10:56 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:8822:ec6c:14d8:eea9]) by smtp.gmail.com with ESMTPSA id q14sm23685397pgt.54.2021.04.07.20.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 20:10:55 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 8 Apr 2021 12:10:40 +0900 Message-Id: <20210408031040.1388568-2-hiroh@chromium.org> X-Mailer: git-send-email 2.31.0.208.g409f899ff0-goog In-Reply-To: <20210408031040.1388568-1-hiroh@chromium.org> References: <20210408031040.1388568-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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..7247c12c 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;