LibWeb: Restrict HTMLInputElement::min_length to the range of i32

This commit is contained in:
Tim Ledbetter 2024-11-30 20:06:38 +00:00 committed by Andreas Kling
parent 40d6b9d44e
commit bc484258c2
Notes: github-actions[bot] 2024-12-02 09:27:00 +00:00
3 changed files with 20 additions and 1 deletions

View file

@ -1849,7 +1849,7 @@ WebIDL::Long HTMLInputElement::min_length() const
{
// The minLength IDL attribute must reflect the minlength content attribute, limited to only non-negative numbers.
if (auto minlength_string = get_attribute(HTML::AttributeNames::minlength); minlength_string.has_value()) {
if (auto minlength = parse_non_negative_integer(*minlength_string); minlength.has_value())
if (auto minlength = parse_non_negative_integer(*minlength_string); minlength.has_value() && *minlength <= 2147483647)
return *minlength;
}
return -1;