瀏覽代碼

AK: Check for u32 overflow in String::repeated()

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.
Andreas Kling 1 年之前
父節點
當前提交
ebe6ec6069
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      AK/String.cpp

+ 1 - 1
AK/String.cpp

@@ -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;