DescriptionCSSParserString::equalIgnoringCase should check string length.
The current equalIgnoringCase just checks whether the given CSSParserString is
the given str's prefix or not.
Suppose that we have the following two strings:
char* str1; // not nul-terminated.
int str1len; // str1's length.
char* str2; // nul-terminated.
strncasecmp(str1, str2, str1len) == 0 doesn't mean str1 and str2 are the same string.
(Using strncasecmp instead of WTF::equalIgnoringCase.)
For example,
str1: "abcdefg" (str1len = 7)
str2: "abcdefghijkl\0"
so strncmp(str1, str2, str1len) returns 0.
BUG=348891
TEST=CSSParserValuesTest.EqualIgnoringCase8BitsString, CSSParserValuesTest.EqualIgnoringCase16BitsString
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=168853
Patch Set 1 #
Total comments: 2
Patch Set 2 : Added unit tests #Patch Set 3 : Added ASSERT. #Patch Set 4 : Fixed linux_debug failure. #
Messages
Total messages: 12 (0 generated)
|