[webkit-changes] [WebKit/WebKit] b41ac5: StringConcatenate's StringTypeAdapter<std::tuple<>...

Žan Doberšek noreply at github.com
Wed Jan 4 13:31:22 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b41ac5266fe96d75848e7de585dc61d6b29d261c
      https://github.com/WebKit/WebKit/commit/b41ac5266fe96d75848e7de585dc61d6b29d261c
  Author: Žan Doberšek <zdobersek at igalia.com>
  Date:   2023-01-04 (Wed, 04 Jan 2023)

  Changed paths:
    M Source/WTF/wtf/text/StringConcatenate.h
    M Tools/TestWebKitAPI/Tests/WTF/StringConcatenate.cpp

  Log Message:
  -----------
  StringConcatenate's StringTypeAdapter<std::tuple<>> incorrectly writes into a 16-bit destination
https://bugs.webkit.org/show_bug.cgi?id=250070

Reviewed by Sam Weinig.

When StringTypeAdapter<std::tuple<...>> writes into any destination string, the
offset value shouldn't be multiplied by the size of the string's character type.
Pointer arithmetic will take care of that on its own.

Test case in the StringConcatenate suite is provided, covering both 8-bit and
16-bit strings constructed partially or completely from a tuple object.

The StringTypeAdapter specialization is also adjusted to only keep a reference
to the tuple object, and not copy it. Passes over the tuple elements are done
with lambdas that take arguments through const lvalue references, avoiding any
copying of the contained elements.

* Source/WTF/wtf/text/StringConcatenate.h:
(WTF::StringTypeAdapter<std::tuple<StringTypes::StringTypeAdapter):
(WTF::StringTypeAdapter<std::tuple<StringTypes::writeTo const):
(WTF::StringTypeAdapter<std::tuple<StringTypes::computeLength):
(WTF::StringTypeAdapter<std::tuple<StringTypes::computeIs8Bit):
* Tools/TestWebKitAPI/Tests/WTF/StringConcatenate.cpp:
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list