test(pdf): R3 O4 corpus edge cases (Number() values, namespaces, BOM, refused subtrees); roxmltree dependency

This commit is contained in:
bchanot committed 2026-10-14 23:34:34 +02:00
1 parent 5f53aaa222
commit e3168215f7
11 files changed
+206 -1

No files matched your search

Generated
+10
View File
@@ -186,6 +186,7 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
name = "faunosteo-core"
version = "0.1.0"
dependencies = [
"roxmltree",
"serde",
"serde_json",
"ts-rs",
@@ -664,6 +665,15 @@ dependencies = [
"libc",
]
[[package]]
name = "roxmltree"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1964b10c76125c36f8afe190065a4bf9a87bf324842c05701330bba9f1cacbb"
dependencies = [
"memchr",
]
[[package]]
name = "rustls"
version = "0.23.46"
+4
View File
@@ -24,6 +24,10 @@ serde_json = { version = "1.0.154", features = ["preserve_order", "float_roundtr
ts-rs = { version = "12.0", features = ["serde-compat", "no-serde-warnings"] }
# Zod `.url()` is `new URL()`: the WHATWG parser of the url crate reproduces it (R2 plan P2).
url = "2.5.8"
# SVG reading (R3): a read-only XML tree, DTD refused by default, node limit; positions give
# the qualified names the allowlist matches. Its tree building recurses: the core prescan caps
# the nesting depth before any parse (crates/core/src/anatomy/svg/prescan.rs).
roxmltree = { version = "=0.21.1", default-features = false, features = ["std", "positions"] }
# The CLI in docker/rust-builder.Dockerfile must be this exact version.
wasm-bindgen = "=0.2.129"
image = { version = "0.25.10", default-features = false, features = ["jpeg", "png", "webp"] }
+1
View File
@@ -19,6 +19,7 @@ ts = ["dep:ts-rs"]
serde.workspace = true
serde_json.workspace = true
url.workspace = true
roxmltree.workspace = true
ts-rs = { workspace = true, optional = true }
[lints]
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg"><g id="osteo-halo"/><path d="M0 0h1"/></svg>

After

Width:  |  Height:  |  Size: 84 B

@@ -0,0 +1 @@
<s:svg xmlns:s="http://www.w3.org/2000/svg"><s:path d="M0 0h1"/></s:svg>
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg"><metadata><rdf>x</rdf></metadata><text><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan><tspan>x</tspan></text><path d="M0 0h1"/></svg>

After

Width:  |  Height:  |  Size: 590 B

@@ -0,0 +1 @@
<svg><path d="M0 0h1"/></svg>

After

Width:  |  Height:  |  Size: 29 B

+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg"><filter id="f"><feGaussianBlur stdDeviation="500 3"/><feGaussianBlur stdDeviation="NaN"/><feGaussianBlur stdDeviation="2.5"/></filter></svg>
<svg xmlns="http://www.w3.org/2000/svg"><filter id="f"><feGaussianBlur stdDeviation="500 3"/><feGaussianBlur stdDeviation="NaN"/><feGaussianBlur stdDeviation="2.5"/><feGaussianBlur stdDeviation="0x10 5"/><feGaussianBlur stdDeviation="Infinity"/><feGaussianBlur stdDeviation="+5,1e3"/><feGaussianBlur stdDeviation=""/><feGaussianBlur stdDeviation=" 200 , 1_0"/><feGaussianBlur stdDeviation="1e-7 150.5"/></filter></svg>

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 418 B

@@ -0,0 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg"><title>a b
c</title><path d="M0 0h1" id="t&#9;x" class="a&#10;b"/></svg>

After

Width:  |  Height:  |  Size: 112 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:x="http://www.w3.org/1999/xlink"><linearGradient id="a"/><linearGradient id="b" x:href="#a"/></svg>

After

Width:  |  Height:  |  Size: 145 B

+183
View File
@@ -496,6 +496,80 @@
"not-svg.svg": {
"rejected": "not_svg"
},
"osteo-halo-id.svg": {
"removed": [],
"tree": {
"ns": "http://www.w3.org/2000/svg",
"name": "svg",
"attrs": {
"xmlns": "http://www.w3.org/2000/svg"
},
"children": [
{
"ns": "http://www.w3.org/2000/svg",
"name": "g",
"attrs": {
"id": "osteo-halo"
},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "path",
"attrs": {
"d": "M0 0h1"
},
"children": []
}
]
}
},
"prefixed-root.svg": {
"rejected": "not_svg"
},
"refused-subtrees.svg": {
"removed": [
"metadata",
"text"
],
"tree": {
"ns": "http://www.w3.org/2000/svg",
"name": "svg",
"attrs": {
"xmlns": "http://www.w3.org/2000/svg"
},
"children": [
{
"ns": "http://www.w3.org/2000/svg",
"name": "path",
"attrs": {
"d": "M0 0h1"
},
"children": []
}
]
}
},
"root-without-namespace.svg": {
"removed": [],
"tree": {
"ns": "http://www.w3.org/2000/svg",
"name": "svg",
"attrs": {
"xmlns": "http://www.w3.org/2000/svg"
},
"children": [
{
"ns": "http://www.w3.org/2000/svg",
"name": "path",
"attrs": {
"d": "M0 0h1"
},
"children": []
}
]
}
},
"script-urls.svg": {
"removed": [
"a",
@@ -589,6 +663,52 @@
"stdDeviation": "2.5"
},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "feGaussianBlur",
"attrs": {
"stdDeviation": "0x10 5"
},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "feGaussianBlur",
"attrs": {
"stdDeviation": "100"
},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "feGaussianBlur",
"attrs": {
"stdDeviation": "5 100"
},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "feGaussianBlur",
"attrs": {
"stdDeviation": ""
},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "feGaussianBlur",
"attrs": {},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "feGaussianBlur",
"attrs": {
"stdDeviation": "1e-7 100"
},
"children": []
}
]
}
@@ -718,8 +838,71 @@
]
}
},
"whitespace-references.svg": {
"removed": [],
"tree": {
"ns": "http://www.w3.org/2000/svg",
"name": "svg",
"attrs": {
"xmlns": "http://www.w3.org/2000/svg"
},
"children": [
{
"ns": "http://www.w3.org/2000/svg",
"name": "title",
"attrs": {},
"children": [
{
"text": "a\tb\nc"
}
]
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "path",
"attrs": {
"class": "a\nb",
"d": "M0 0h1",
"id": "t\tx"
},
"children": []
}
]
}
},
"wrong-root-namespace.svg": {
"rejected": "not_svg"
},
"xlink-other-prefix.svg": {
"removed": [
"svg@xmlns:x",
"linearGradient@x:href"
],
"tree": {
"ns": "http://www.w3.org/2000/svg",
"name": "svg",
"attrs": {
"xmlns": "http://www.w3.org/2000/svg"
},
"children": [
{
"ns": "http://www.w3.org/2000/svg",
"name": "linearGradient",
"attrs": {
"id": "a"
},
"children": []
},
{
"ns": "http://www.w3.org/2000/svg",
"name": "linearGradient",
"attrs": {
"id": "b"
},
"children": []
}
]
}
}
},
"specs": [