rust-cssparser
rust-cssparser copied to clipboard
[unicode-range] Avoid integer overflow (panic in debug builds)
If a long string of hex digits are passed to unicode-range, the code tries to parse them into a number before checking whether there are more than the 6 digits allowed by the syntax, and this may lead to integer overflow.
To avoid this, check the number of digits and error out earlier if there are too many to possibly be valid.
(See https://bugzilla.mozilla.org/show_bug.cgi?id=1900403)