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();