1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:48:14 +00:00

LibWeb: Fix some SVG crashes/hangs

- parse_flag now only parses one digit instead of consuming an entirely
valid number
- match_number => match_coordinate
- match_coordinate now returns true if `ch()` is '.'
- parse_number no longer matches a +/-
- Don't crash when encountering one of the three unsupported path
commands. Instead, just skip them. No reason to crash the browser over a
silly SVG element :)
This commit is contained in:
Matthew Olsson 2020-08-02 09:15:17 -07:00 committed by Andreas Kling
parent 97256ad977
commit 81187c4ead
2 changed files with 92 additions and 84 deletions

View file

@ -85,10 +85,12 @@ private:
float parse_fractional_constant();
float parse_number();
float parse_flag();
// -1 if negative, +1 otherwise
int parse_sign();
bool match_whitespace() const;
bool match_comma_whitespace() const;
bool match_number() const;
bool match_coordinate() const;
bool match(char c) const { return !done() && ch() == c; }
bool done() const { return m_cursor >= m_source.length(); }