[Webkit-unassigned] [Bug 234944] New: WTF::HashAndUTF8CharactersTranslator::translate() falls through ASSERT_NOT_REACHED()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 6 18:59:51 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=234944

            Bug ID: 234944
           Summary: WTF::HashAndUTF8CharactersTranslator::translate()
                    falls through ASSERT_NOT_REACHED()
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Template Framework
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ddkilzer at webkit.org
                CC: webkit-bug-importer at group.apple.com
        Depends on: 234932

WTF::HashAndUTF8CharactersTranslator::translate() falls through ASSERT_NOT_REACHED().

Also uses the `isAllASCII` stack variable uninitialized.  The `newString` backing buffer may not be initialized, either.

    static void translate(PackedPtr<StringImpl>& location, const HashAndUTF8Characters& buffer, unsigned hash)
    {
        UChar* target;
        auto newString = StringImpl::createUninitialized(buffer.utf16Length, target);

        bool isAllASCII;
        const char* source = buffer.characters;
        if (!convertUTF8ToUTF16(source, source + buffer.length, &target, target + buffer.utf16Length, &isAllASCII))
            ASSERT_NOT_REACHED();

        if (isAllASCII)
            newString = StringImpl::create(buffer.characters, buffer.length);

        auto* pointer = &newString.leakRef();
        pointer->setHash(hash);
        pointer->setIsAtom(true);
        location = pointer;
    }


Referenced Bugs:

https://bugs.webkit.org/show_bug.cgi?id=234932
[Bug 234932] check-webkit-style: add checker for unexpected fall through after ASSERT_NOT_REACHED() statements
-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220107/83dbcd98/attachment.htm>


More information about the webkit-unassigned mailing list