From bfada6f7758ce6d0fc85445733b1abe291de045f Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Thu, 5 Nov 2026 14:29:28 +0100 Subject: [PATCH] Check VideoFrame buffer size against coded size The VideoFrame(data, init) constructor computed its required allocation size from the visible rect, so a buffer too small for the coded frame was accepted. Compute the layout over the coded rect instead, matching Chromium. Fixes #516 --- index.src.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.src.html b/index.src.html index e4fadd2d..2d6cb6ae 100644 --- a/index.src.html +++ b/index.src.html @@ -3668,7 +3668,9 @@ 8. If |init|.{{VideoFrameBufferInit/layout}} [=map/exists=], assign its value to |optLayout|. 9. Let |combinedLayout| be the result of running the [=VideoFrame/Compute - Layout and Allocation Size=] algorithm with |parsedRect|, + Layout and Allocation Size=] algorithm with «[ "x" → `0`, "y" → `0`, + "width" → |init|.{{VideoFrameBufferInit/codedWidth}}, + "height" → |init|.{{VideoFrameBufferInit/codedHeight}} ]», |init|.{{VideoFrameBufferInit/format}}, and |optLayout|. 10. If |combinedLayout| is an exception, throw |combinedLayout|. 11. If `data.byteLength` is less than |combinedLayout|’s