Changeset 178099 in webkit


Ignore:
Timestamp:
Jan 7, 2015 9:18:20 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

The ASCII decoding for non ASCII character is incorrect if this character comes after going through the fast decoding code path and before the end of the text by less than a machine word size of characters.
https://bugs.webkit.org/show_bug.cgi?id=140173.

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2015-01-07
Reviewed by Darin Adler.

Source/WebCore:

Tests: fast/encoding/char-after-fast-path-ascii-decoding.html.

  • platform/text/TextCodecLatin1.cpp:

(WebCore::TextCodecLatin1::decode):
This function has a bug when it goes through the fast decoding code path. After copying
one or more all ASCII MachineWords from source to the destination, the following byte
is copied as is from the source to the destination even if it is non ASCII byte. This
causes the decoded bytes to be incorrect. The fix is to ensure that the current byte
is still ASCII after exiting the fast decoding code path.

LayoutTests:

  • fast/encoding/char-after-fast-path-ascii-decoding-expected.txt: Added.
  • fast/encoding/char-after-fast-path-ascii-decoding.html: Added.

Ensures when an non ASCII character comes after a machine word, whose bytes are all
ASCII characters, is decoded correctly.

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r178097 r178099  
     12015-01-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        The ASCII decoding for non ASCII character is incorrect if this character comes after going through the fast decoding code path and before the end of the text by less than a machine word size of characters.
     4        https://bugs.webkit.org/show_bug.cgi?id=140173.
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/encoding/char-after-fast-path-ascii-decoding-expected.txt: Added.
     9        * fast/encoding/char-after-fast-path-ascii-decoding.html: Added.
     10        Ensures when an non ASCII character comes after a machine word, whose bytes are all
     11        ASCII characters, is decoded correctly.
     12
    1132015-01-07  Shivakumar JM  <shiva.jm@samsung.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r178097 r178099  
     12015-01-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        The ASCII decoding for non ASCII character is incorrect if this character comes after going through the fast decoding code path and before the end of the text by less than a machine word size of characters.
     4        https://bugs.webkit.org/show_bug.cgi?id=140173.
     5
     6        Reviewed by Darin Adler.
     7
     8        Tests: fast/encoding/char-after-fast-path-ascii-decoding.html.
     9
     10        * platform/text/TextCodecLatin1.cpp:
     11        (WebCore::TextCodecLatin1::decode):
     12        This function has a bug when it goes through the fast decoding code path. After copying
     13        one or more all ASCII MachineWords from source to the destination, the following byte
     14        is copied as is from the source to the destination even if it is non ASCII byte. This
     15        causes the decoded bytes to be incorrect. The fix is to ensure that the current byte
     16        is still ASCII after exiting the fast decoding code path.
     17 
    1182015-01-07  Shivakumar JM  <shiva.jm@samsung.com>
    219
  • trunk/Source/WebCore/platform/text/TextCodecLatin1.cpp

    r177280 r178099  
    147147                if (source == end)
    148148                    break;
     149
     150                // *source may not be ASCII anymore if source moves inside the loop of the fast code path
     151                if (!isASCII(*source))
     152                    goto useLookupTable;
    149153            }
    150154            *destination = *source;
     
    198202                if (source == end)
    199203                    break;
     204
     205                // *source may not be ASCII anymore if source moves inside the loop of the fast code path
     206                if (!isASCII(*source))
     207                    goto useLookupTable16;
    200208            }
    201209            *destination16 = *source;
Note: See TracChangeset for help on using the changeset viewer.