[webkit-changes] [WebKit/WebKit] 0e100e: Drop use of WTF_ALLOW_UNSAFE_BUFFER_USAGE in UTF8C...

Chris Dumez noreply at github.com
Sat Feb 1 10:07:11 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0e100e6b52e2498fbf3161504e02fdd6fab6cce9
      https://github.com/WebKit/WebKit/commit/0e100e6b52e2498fbf3161504e02fdd6fab6cce9
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2025-02-01 (Sat, 01 Feb 2025)

  Changed paths:
    M Source/WTF/wtf/text/icu/UnicodeExtras.h
    M Source/WTF/wtf/unicode/UTF8Conversion.cpp

  Log Message:
  -----------
  Drop use of WTF_ALLOW_UNSAFE_BUFFER_USAGE in UTF8Conversion.cpp
https://bugs.webkit.org/show_bug.cgi?id=286844

Reviewed by Geoffrey Garen.

The U8_NEXT() and U8_NEXT_OR_FFFD() macros from ICU ended doing indexing
on U8_LEAD3_T1_BITS and U8_LEAD4_T1_BITS, which were `const char*`. This
wasn't bound safe.

Introduce new U8_NEXT_SPAN() and U8_NEXT_OR_FFFD_SPAN() macros which:
1. Take in a span instead of a separate pointer and size
2. Relying on versions of U8_LEAD3_T1_BITS & U8_LEAD4_T1_BITS which use
   std::array and are thus bounds-safe.

* Source/WTF/wtf/text/icu/UnicodeExtras.h:
* Source/WTF/wtf/unicode/UTF8Conversion.cpp:
(WTF::Unicode::char8_t>):

Canonical link: https://commits.webkit.org/289671@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list