Changeset 49487 in webkit


Ignore:
Timestamp:
Oct 12, 2009 5:47:41 PM (14 years ago)
Author:
weinig@apple.com
Message:

Fix for https://bugs.webkit.org/show_bug.cgi?id=29078
<rdar://problem/7288221>

Reviewed by Darin Adler.

WebCore:

Add a mechanism to blacklist certain codecs. Initially, just blacklist UTF-7 as HTML5 encourages.

  • platform/text/TextEncodingRegistry.cpp:

(WebCore::pruneBlacklistedCodecs):
(WebCore::buildBaseTextCodecMaps):
(WebCore::extendTextCodecMaps):

LayoutTests:

Test the lack of UTF-7 support. Remove old UTF-7 tests.

  • fast/encoding/char-decoding-expected.txt:
  • fast/encoding/char-decoding.html:
  • http/tests/misc/submit-get-in-utf7-expected.txt: Removed.
  • http/tests/misc/submit-get-in-utf7.html: Removed.
  • http/tests/misc/submit-post-in-utf7-expected.txt: Removed.
  • http/tests/misc/submit-post-in-utf7.html: Removed.
  • http/tests/misc/url-in-utf7-expected.txt: Removed.
  • http/tests/misc/url-in-utf7.html: Removed.
  • http/tests/security/xssAuditor/http-equiv-utf-7-encoded-expected.txt: Removed.
  • http/tests/security/xssAuditor/http-equiv-utf-7-encoded.html: Removed.
  • http/tests/security/xssAuditor/resources/echo-intertag-utf-7.pl: Removed.
  • http/tests/security/xssAuditor/script-tag-utf-7-encoded-expected.txt: Removed.
  • http/tests/security/xssAuditor/script-tag-utf-7-encoded.html: Removed.
  • http/tests/security/xssAuditor/script-tag-utf-7-expected.txt: Removed.
  • http/tests/security/xssAuditor/script-tag-utf-7.html: Removed.
Location:
trunk
Files:
13 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r49484 r49487  
     12009-10-12  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=29078
     6        <rdar://problem/7288221>
     7
     8        Test the lack of UTF-7 support. Remove old UTF-7 tests.
     9
     10        * fast/encoding/char-decoding-expected.txt:
     11        * fast/encoding/char-decoding.html:
     12        * http/tests/misc/submit-get-in-utf7-expected.txt: Removed.
     13        * http/tests/misc/submit-get-in-utf7.html: Removed.
     14        * http/tests/misc/submit-post-in-utf7-expected.txt: Removed.
     15        * http/tests/misc/submit-post-in-utf7.html: Removed.
     16        * http/tests/misc/url-in-utf7-expected.txt: Removed.
     17        * http/tests/misc/url-in-utf7.html: Removed.
     18        * http/tests/security/xssAuditor/http-equiv-utf-7-encoded-expected.txt: Removed.
     19        * http/tests/security/xssAuditor/http-equiv-utf-7-encoded.html: Removed.
     20        * http/tests/security/xssAuditor/resources/echo-intertag-utf-7.pl: Removed.
     21        * http/tests/security/xssAuditor/script-tag-utf-7-encoded-expected.txt: Removed.
     22        * http/tests/security/xssAuditor/script-tag-utf-7-encoded.html: Removed.
     23        * http/tests/security/xssAuditor/script-tag-utf-7-expected.txt: Removed.
     24        * http/tests/security/xssAuditor/script-tag-utf-7.html: Removed.
     25
    1262009-10-12  Dan Bernstein  <mitz@apple.com>
    227
  • trunk/LayoutTests/fast/encoding/char-decoding-expected.txt

    r39021 r49487  
    154154PASS decode('dos-874', '%A1') is 'U+0E01'
    155155PASS decode('dos-874', '%DB') is 'U+F8C1'
     156PASS decode('UTF-7', '+AD4') is 'U+002B'
     157PASS decode('utf-7', '+AD4') is 'U+002B'
    156158PASS successfullyParsed is true
    157159
  • trunk/LayoutTests/fast/encoding/char-decoding.html

    r39021 r49487  
    8484batchTestDecode(thai);
    8585
     86// UTF-7 is expressly forbidden, so decoding it should not work correctly.
     87// This attempts to decode '<' as UTF-7 (+AD4) but it ends up being decoded
     88// as a '+'.
     89testDecode('UTF-7', '+AD4', 'U+002B');
     90testDecode('utf-7', '+AD4', 'U+002B');
     91
    8692successfullyParsed = true;
    8793
  • trunk/WebCore/ChangeLog

    r49486 r49487  
     12009-10-12  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=29078
     6        <rdar://problem/7288221>
     7
     8        Add a mechanism to blacklist certain codecs.  Initially, just blacklist UTF-7 as HTML5 encourages.
     9
     10        * platform/text/TextEncodingRegistry.cpp:
     11        (WebCore::pruneBlacklistedCodecs):
     12        (WebCore::buildBaseTextCodecMaps):
     13        (WebCore::extendTextCodecMaps):
     14
    1152009-10-09  Dave Hyatt  <hyatt@apple.com>
    216
  • trunk/WebCore/platform/text/TextEncodingRegistry.cpp

    r48508 r49487  
    130130static bool didExtendTextCodecMaps;
    131131
     132static const char* const textEncodingNameBlacklist[] = {
     133    "UTF-7"
     134};
     135
    132136#if ERROR_DISABLED
    133137
     
    172176}
    173177
     178static void pruneBlacklistedCodecs()
     179{
     180    size_t blacklistedCodecListLength = sizeof(textEncodingNameBlacklist) / sizeof(textEncodingNameBlacklist[0]);
     181    for (size_t i = 0; i < blacklistedCodecListLength; ++i) {
     182        const char* atomicName = textEncodingNameMap->get(textEncodingNameBlacklist[i]);
     183        if (!atomicName)
     184            continue;
     185
     186        Vector<const char*> names;
     187        TextEncodingNameMap::const_iterator it = textEncodingNameMap->begin();
     188        TextEncodingNameMap::const_iterator end = textEncodingNameMap->end();
     189        for (; it != end; ++it) {
     190            if (it->second == atomicName)
     191                names.append(it->first);
     192        }
     193
     194        size_t length = names.size();
     195        for (size_t j = 0; j < length; ++j)
     196            textEncodingNameMap->remove(names[j]);
     197
     198        textCodecMap->remove(atomicName);
     199    }
     200}
     201
    174202static void buildBaseTextCodecMaps()
    175203{
     
    222250    TextCodecWince::registerExtendedCodecs(addToTextCodecMap);
    223251#endif
     252
     253    pruneBlacklistedCodecs();
    224254}
    225255
Note: See TracChangeset for help on using the changeset viewer.