<rdar://problem/5757873> Buffer overrun in DeprecatedCString::find() in WebCore
authoradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Feb 2008 01:07:35 +0000 (01:07 +0000)
committeradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Feb 2008 01:07:35 +0000 (01:07 +0000)
commit211aacec0aadc3c8227e84b866176fd76deb483e
tree4f9e435dc4e9c557a70d8d5d04ceeeedf42f03f6
parentf2b1b4e40ffaed71b98ed0f98a7d551609fb9f04
    <rdar://problem/5757873> Buffer overrun in DeprecatedCString::find() in WebCore
        We could get a buffer overrun in DeprecatedCString::find() if the end of the
        string matches a beginning portion of the substring, for example, if string is
        "a" but the substring is "ab".
        The code as is also will not match things correctly under certain situations
        since the inner while loop increments the index. For example, we wouldn't find
        a match if the string is "aab..." and the substring is "ab".  Changed the
        inner while loop to increment a temporary index into str.

        Test: fast/loader/charset-parse.html

        Reviewed by Dan Berstein.

        * platform/DeprecatedCString.cpp:
        (WebCore::DeprecatedCString::find):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/loader/charset-parse-expected.txt [new file with mode: 0644]
LayoutTests/fast/loader/charset-parse.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/DeprecatedCString.cpp