mirror of
https://github.com/freemkv/libfreemkv.git
synced 2026-10-07 18:13:10 +00:00
Security - Remove the unsafe Vec::set_len over recycled sector buffers — UB reachable from safe code (GHSA-j8ww-f5fg-9pmh, low). Uses Vec::resize; pooling unchanged. CI / tooling - clippy on stable with the MSRV single-sourced from Cargo.toml; cargo-deny dependency-audit gate with first-party git sources allowed (#15); audience-based comment-guard (#17). Docs - README (keydb ownership, BD-J parser count), drive-access transport/reset notes, mux timeline module-doc links.
1.3 KiB
1.3 KiB
src/labels/xml.rs
Tolerant XML scraping helpers — promoted from two near-duplicate hand-rolls
in paramount.rs (attribute extraction) and criterion.rs (tag-text
extraction).
These are NOT a full XML parser. They handle the subset of XML the BD-J
authoring tools we've seen actually emit: ASCII tag/attr names, no entity
references inside label strings, optional XML namespaces. Hardening goals
over the prior find("<tag>") / find(r#"name=""#) matchers:
- Case-insensitive tag and attribute names — vendors casing is inconsistent across authoring-tool revisions.
- Namespace-aware — strip an optional
ns:prefix so<ns:playlist>and<playlist>both match. - Whitespace-tolerant — multiple/tab/newline characters around
=between attribute name and value; whitespace inside the opening tag. - Quote-style tolerant — both
"value"and'value'. - Self-closing tag handling —
<tag />and<tag/>both work;text()returnsSome("")for empty content.
Out of scope (intentionally simple): XML entity decoding (&, <,
etc.), CDATA sections, comments, processing instructions, DTD
declarations. None of the BD-J authored disc data we've observed
exercises any of those — labels are plain ASCII/Latin-1 in attribute
values.