From d6b601790f6c889bc35db29d3922741a9ae52519 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Fri, 17 Mar 2023 10:39:33 +0000 Subject: [PATCH] dawn.node: Remove unnecessary check that TypedArrays are in bounds This should be done by V8 on the creation of TypedArray anyways. Bug: None Change-Id: Ia0eacfe3a0434acf81b7d0d6473db9aa97c78c09 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122121 Commit-Queue: Ben Clayton Reviewed-by: Ben Clayton Kokoro: Kokoro --- src/dawn/node/binding/Converter.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/dawn/node/binding/Converter.cpp b/src/dawn/node/binding/Converter.cpp index 31a293da70..98c1619410 100644 --- a/src/dawn/node/binding/Converter.cpp +++ b/src/dawn/node/binding/Converter.cpp @@ -153,20 +153,15 @@ bool Converter::Convert(wgpu::ImageCopyBuffer& out, const interop::GPUImageCopyB bool Converter::Convert(BufferSource& out, interop::BufferSource in) { out = {}; if (auto* view = std::get_if(&in)) { - return std::visit( + std::visit( [&](auto&& v) { auto arr = v.ArrayBuffer(); - if (v.ByteOffset() + v.ByteLength() > arr.ByteLength()) { - Napi::Error::New(env, "offset + length exceeds underlying buffer size") - .ThrowAsJavaScriptException(); - return false; - } out.data = static_cast(arr.Data()) + v.ByteOffset(); out.size = v.ByteLength(); out.bytesPerElement = v.ElementSize(); - return true; }, *view); + return true; } if (auto* arr = std::get_if(&in)) { out.data = arr->Data();