[Webkit-unassigned] [Bug 128068] graphics/StringTruncator.cpp:172: possible bad array index ?
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Feb 19 13:37:47 PST 2014
https://bugs.webkit.org/show_bug.cgi?id=128068
Daniel Bates <dbates at webkit.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dbates at webkit.org
--- Comment #1 from Daniel Bates <dbates at webkit.org> 2014-02-19 13:34:58 PST ---
(In reply to comment #0)
> 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
I'm unclear how your proposed change would work given the omission of the body of the if-statement.
--
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