Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e7cbc847fb3d561ea3742404e65b9c56389ff263
      
https://github.com/WebKit/WebKit/commit/e7cbc847fb3d561ea3742404e65b9c56389ff263
  Author: Chris Dumez <[email protected]>
  Date:   2026-04-02 (Thu, 02 Apr 2026)

  Changed paths:
    M Source/WebCore/PAL/pal/text/TextCodecUTF8.cpp

  Log Message:
  -----------
  Reduce over-allocation in TextCodecUTF8::encodeUTF8() for 8-bit strings
https://bugs.webkit.org/show_bug.cgi?id=311345

Reviewed by Anne van Kesteren.

TextCodecUTF8::encodeUTF8() unconditionally allocated 3x the input
length for the output buffer. The 3x multiplier is correct for 16-bit
strings (BMP characters can expand to 3 UTF-8 bytes per code unit),
but for 8-bit Latin1 strings the maximum expansion is only 2x
(characters 0x80-0xFF encode as 2-byte UTF-8 sequences).

* Source/WebCore/PAL/pal/text/TextCodecUTF8.cpp:
(PAL::TextCodecUTF8::encodeUTF8):

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



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

Reply via email to