[webkit-changes] [WebKit/WebKit] aff0d1: Integer truncation in TextCodecUTF8::decode leadin...

Alex Christensen noreply at github.com
Tue Aug 6 14:30:36 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: aff0d180af6eb73a95f65bafcf52754d0394f546
      https://github.com/WebKit/WebKit/commit/aff0d180af6eb73a95f65bafcf52754d0394f546
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2024-08-06 (Tue, 06 Aug 2024)

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

  Log Message:
  -----------
  Integer truncation in TextCodecUTF8::decode leading to OOB writes
rdar://130946877

Reviewed by Darin Adler.

If the length plus the length of the previously attempted partial UTF-8 sequence
is greater than can fit into an unsigned, we will truncate the length and write
the long length, which isn't ideal.

The Latin-1 codec appears to have a similar issue but it doesn't keep state, so
I think it's unreachable.  To make it more clear in code inspection that it is
unreachable, I added a check to be extra safe.

* LayoutTests/security/decode-buffer-size-expected.txt: Added.
* LayoutTests/security/decode-buffer-size.html: Added.
* Source/WebCore/PAL/pal/text/TextCodecLatin1.cpp:
(PAL::TextCodecLatin1::decode):
* Source/WebCore/PAL/pal/text/TextCodecUTF8.cpp:
(PAL::TextCodecUTF8::decode):

Originally-landed-as: dfa712ddc5a1. rdar://132958322
Canonical link: https://commits.webkit.org/281916@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