Title: [282534] releases/WebKitGTK/webkit-2.32/Source/WebCore
Revision
282534
Author
[email protected]
Date
2021-09-16 03:36:35 -0700 (Thu, 16 Sep 2021)

Log Message

Merge r278207 - Buffer computations should use correct type
https://bugs.webkit.org/show_bug.cgi?id=226352
<rdar://problem/78116213>

Reviewed by Ryosuke Niwa.

The implementation of utf8Buffer holds the buffer size in an 'int', even though our buffer
APIs take size_t arguments. Let's make this consistent.

* platform/SharedBuffer.cpp:
(WebCore::utf8Buffer):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog (282533 => 282534)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-09-16 10:36:30 UTC (rev 282533)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-09-16 10:36:35 UTC (rev 282534)
@@ -1,3 +1,17 @@
+2021-05-28  Brent Fulgham  <[email protected]>
+
+        Buffer computations should use correct type
+        https://bugs.webkit.org/show_bug.cgi?id=226352
+        <rdar://problem/78116213>
+
+        Reviewed by Ryosuke Niwa.
+
+        The implementation of utf8Buffer holds the buffer size in an 'int', even though our buffer
+        APIs take size_t arguments. Let's make this consistent.
+
+        * platform/SharedBuffer.cpp:
+        (WebCore::utf8Buffer):
+
 2021-05-25  Ian Gilbert  <[email protected]>
 
         Only create MediaElementSession when necessary

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/SharedBuffer.cpp (282533 => 282534)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/SharedBuffer.cpp	2021-09-16 10:36:30 UTC (rev 282533)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/SharedBuffer.cpp	2021-09-16 10:36:35 UTC (rev 282534)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2021 Apple Inc. All rights reserved.
  * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
  * Copyright (C) 2015 Canon Inc. All rights reserved.
  *
@@ -345,7 +345,12 @@
 RefPtr<SharedBuffer> utf8Buffer(const String& string)
 {
     // Allocate a buffer big enough to hold all the characters.
-    const int length = string.length();
+    const size_t length = string.length();
+    if constexpr (String::MaxLength > std::numeric_limits<size_t>::max() / 3) {
+        if (length > std::numeric_limits<size_t>::max() / 3)
+            return nullptr;
+    }
+
     Vector<char> buffer(length * 3);
 
     // Convert to runs of 8-bit characters.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to