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

This commit is contained in:
Tim Ledbetter 2024-11-30 22:00:16 +00:00 committed by Andreas Kling
parent ac7fad52f6
commit 7097152ebc
Notes: github-actions[bot] 2024-12-02 09:26:49 +00:00
3 changed files with 21 additions and 2 deletions

View file

@ -276,7 +276,7 @@ WebIDL::Long HTMLTextAreaElement::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;