Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 98d7962dd25c6dfa50d334389d385817308171b3
https://github.com/WebKit/WebKit/commit/98d7962dd25c6dfa50d334389d385817308171b3
Author: Kristian Monsen <[email protected]>
Date: 2026-07-13 (Mon, 13 Jul 2026)
Changed paths:
A
LayoutTests/webgl/webgl2-draw-elements-unaligned-buffer-nocrash-expected.txt
A LayoutTests/webgl/webgl2-draw-elements-unaligned-buffer-nocrash.html
M Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/BufferMtl.mm
Log Message:
-----------
WebGL2: drawElements with UNSIGNED_INT indices crashes when element array
buffer size is not a multiple of 4
https://bugs.webkit.org/show_bug.cgi?id=319175
rdar://181799978
Reviewed by Dan Glastonbury.
CalculateDrawIndexRanges<T> passes the raw buffer byte span directly to
angle::reinterpret_span<const T>, which asserts that the span size is a
multiple of sizeof(T). When a WebGL2
drawElements call is made with UNSIGNED_INT indices against a buffer whose size
is not a multiple of 4, this assertion fires and aborts the GPU process.
Fix: truncate the span to floor(size / sizeof(T)) * sizeof(T) bytes before
calling reinterpret_span. The trailing partial bytes cannot form a complete
index and are correctly
ignored.
Test: webgl/webgl2-draw-elements-unaligned-buffer-nocrash.html
* LayoutTests/webgl/webgl2-draw-elements-unaligned-buffer-nocrash-expected.txt:
Added.
* LayoutTests/webgl/webgl2-draw-elements-unaligned-buffer-nocrash.html: Added.
* Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/BufferMtl.mm:
(rx::CalculateDrawIndexRanges):
Canonical link: https://commits.webkit.org/317110@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications