Skip to content

Commit

Permalink
AK: Check for u32 overflow in String::repeated()
Browse files Browse the repository at this point in the history
I don't know why this was checking for size_t overflow, but it was
tripping up ASAN malloc() checks by passing a way-too-large size.
  • Loading branch information
awesomekling committed May 6, 2024
1 parent c03cf4b commit 6cef087
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion AK/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ bool String::equals_ignoring_ascii_case(StringView other) const

ErrorOr<String> String::repeated(String const& input, size_t count)
{
if (Checked<size_t>::multiplication_would_overflow(count, input.bytes().size()))
if (Checked<u32>::multiplication_would_overflow(count, input.bytes().size()))
return Error::from_errno(EOVERFLOW);

String result;
Expand Down

0 comments on commit 6cef087

Please sign in to comment.