Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c8676c91582c3851d63c20a646b2dbb9cd76ee26
      
https://github.com/WebKit/WebKit/commit/c8676c91582c3851d63c20a646b2dbb9cd76ee26
  Author: Anne van Kesteren <[email protected]>
  Date:   2026-04-13 (Mon, 13 Apr 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/encoding/textdecoder-mistakes.any-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/encoding/textdecoder-mistakes.any.worker-expected.txt
    M 
LayoutTests/platform/glib/imported/w3c/web-platform-tests/encoding/textdecoder-mistakes.any-expected.txt
    M 
LayoutTests/platform/glib/imported/w3c/web-platform-tests/encoding/textdecoder-mistakes.any.worker-expected.txt
    M Source/WebCore/PAL/pal/text/TextCodecCJK.cpp

  Log Message:
  -----------
  Reset CJK encoding state appropriately
https://bugs.webkit.org/show_bug.cgi?id=312106

Reviewed by Chris Dumez.

We did not reset state correctly for CJK encodings:

1. decodeCommon: Clear m_prependedByte on fatal early return. When
   byteParser() sets m_prependedByte (pushing back an ASCII byte) and
   returns error, the stopOnError early return cleared m_lead but not
   m_prependedByte, leaking it into the next decode() call.

2. eucJPDecode: Reset m_jis0212 unconditionally when lead is non-zero.
   The spec resets jis0212 at the start of lead-byte processing
   regardless of whether the trail byte is valid, but the code only
   reset it inside the successful range check. Also reset m_jis0212 on
   flush.

3. iso2022JPDecode: Fix flush handler for EscapeStart/Escape/TrailByte
   states. TrailByte no longer falls through to EscapeStart (they're
   separate states with different EOF behavior). Escape now reprocesses
   the lead byte through byteParser in the output state instead of
   appending it as a literal character. All ISO-2022-JP state is reset
   after flush.

4. iso2022JPDecode: Fix m_iso2022JPSecondPrependedByte error handling.
   The outer condition had && stopOnError, silently swallowing errors
   in non-fatal mode. Removed to match the m_prependedByte pattern.

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



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

Reply via email to