canvas: Don't do operations on paths with uninvertible transforms (#37551)

When the path is created with an uninvertible transform, don't do any
path-based operations. Now `ensure_path()` returns a `Path` object and
this change adds early returns which prevent trying to use it.

Testing: This change adds a WPT crash test.
Fixes #36995.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-06-19 12:48:20 +02:00 committed by GitHub
parent a27c9ee691
commit e5c328d660
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 39 additions and 42 deletions

View file

@ -7814,6 +7814,15 @@
],
"element": {
"manual": {
"drawing-paths-to-the-canvas": {
"fill-path-with-uninvertible-transform-crash.html": [
"9d032ddba9637c8bee07c8cb9c4ec618a1c5d701",
[
null,
{}
]
]
},
"filters": {
"svg-filter-crash.html": [
"f64379c79241409ab55535596f4cbad894f45b42",

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<script>
let context = document.createElement("canvas").getContext("2d");
context.moveTo(0, 0);
context.setTransform(4, 2, 6, 3, 0, 0); // non-invertible (4 * 3 - 6 * 2 = 0)
context.fill("nonzero");
</script>