[Webkit-unassigned] [Bug 128068] New: graphics/StringTruncator.cpp:172: possible bad array index ?

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Feb 2 00:31:19 PST 2014


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

           Summary: graphics/StringTruncator.cpp:172: possible bad array
                    index ?
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Platform
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: dcb314 at hotmail.com


I just ran the static analyser "cppcheck" over the source
code of webkitgtk-2.3.4

It said many things, including

[Source/WebCore/platform/graphics/StringTruncator.cpp:172]: (style) Array index 'adjustedStartIndex' is used before limits check.

Source code is

    // Strip single character after ellipsis character, when that character is preceded by a space
    if (adjustedStartIndex < length && string[adjustedStartIndex] != space
        && adjustedStartIndex < length - 1 && string[adjustedStartIndex + 1] == space)
        ++adjustedStartIndex;

Maybe

    if (adjustedStartIndex < length && string[adjustedStartIndex] != space
        && adjustedStartIndex > 0 && string[adjustedStartIndex - 1] == space)

would be better code

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list