Skip to content

[Bug]: SVG marker images skip the XML namespace limit #3220

Done

Description

@jgregoriorincon

What happened?

rustgis_data::xml::parse refuses a document whose namespaces would take too long to resolve, but the SVG marker reader (svg::read, crates/render/src/picture/svg.rs) parses without that check. Such an SVG is accepted as a marker image after seconds of work.

Steps to reproduce

Run picture_marker_check on this SVG:

let ns: String = (0..3000).map(|i| format!(r#" xmlns:n{i}="u{i}""#)).collect();
let body = r#"<g xmlns:a="v"/>"#.repeat(1000);
let svg = format!(r##"<svg xmlns="http://www.w3.org/2000/svg"{ns} viewBox="0 0 8 4">{body}<rect width="8" height="4"/></svg>"##);

Measured in a test build: 250 children (61,872 bytes) 4.0 s, 500 (65,872) 4.8 s, 1,000 (73,872) 7.5 s, all accepted.

Expected behavior

The image is refused as too much to read, as other XML readers refuse such a document.

How are you running RustGIS?

Desktop app (built from source)

Version

c7e0f6b

Operating system, browser and graphics

Linux

Activity

  1. jgregoriorincon commented on Nov 28, 2026

    @jgregoriorincon
    ContributorAuthor

    I'll take this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions