CairoSVG: Quadratic-time DoS parsing a crafted SVG <path>
Rendering an untrusted SVG whose <path d="…"> contains many segments is O(n²) CPU. A single <path> under 1 MiB burns tens of seconds. Two independent O(n²) sites in cairosvg/path.py: Tokenizer — the path-data parser consumes the d string with a while string: loop that repeatedly slices/re-scans the remaining string (each step is O(len remaining)), giving O(n²) over the whole attribute. draw_markers — marker handling drains node.vertices with while node.vertices: … …