Title: [250520] trunk/Source/WTF
Revision
250520
Author
[email protected]
Date
2019-09-30 11:15:27 -0700 (Mon, 30 Sep 2019)

Log Message

Add some assertions to convertUTF8ToUTF16().
https://bugs.webkit.org/show_bug.cgi?id=202356
<rdar://problem/52846813>

Reviewed by Filip Pizlo.

* wtf/unicode/UTF8Conversion.cpp:
(WTF::Unicode::convertUTF8ToUTF16):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (250519 => 250520)


--- trunk/Source/WTF/ChangeLog	2019-09-30 15:55:37 UTC (rev 250519)
+++ trunk/Source/WTF/ChangeLog	2019-09-30 18:15:27 UTC (rev 250520)
@@ -1,3 +1,14 @@
+2019-09-30  Mark Lam  <[email protected]>
+
+        Add some assertions to convertUTF8ToUTF16().
+        https://bugs.webkit.org/show_bug.cgi?id=202356
+        <rdar://problem/52846813>
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/unicode/UTF8Conversion.cpp:
+        (WTF::Unicode::convertUTF8ToUTF16):
+
 2019-09-30  Guillaume Emont  <[email protected]>
 
         Don't try to use backtrace() on MIPS

Modified: trunk/Source/WTF/wtf/unicode/UTF8Conversion.cpp (250519 => 250520)


--- trunk/Source/WTF/wtf/unicode/UTF8Conversion.cpp	2019-09-30 15:55:37 UTC (rev 250519)
+++ trunk/Source/WTF/wtf/unicode/UTF8Conversion.cpp	2019-09-30 18:15:27 UTC (rev 250520)
@@ -92,6 +92,7 @@
     RELEASE_ASSERT(sourceEnd - source <= std::numeric_limits<int>::max());
     UBool error = false;
     UChar* target = *targetStart;
+    RELEASE_ASSERT(targetEnd - target <= std::numeric_limits<int>::max());
     UChar32 orAllData = 0;
     int targetOffset = 0;
     for (int sourceOffset = 0; sourceOffset < sourceEnd - source; ) {
@@ -104,6 +105,7 @@
             return false;
         orAllData |= character;
     }
+    RELEASE_ASSERT(target + targetOffset <= targetEnd);
     *targetStart = target + targetOffset;
     if (sourceAllASCII)
         *sourceAllASCII = isASCII(orAllData);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to