Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Issue 189843005: CSSParserString::equalIgnoringCase should check string length. (Closed)

Created:
6 years, 9 months ago by tasak
Modified:
6 years, 9 months ago
CC:
blink-reviews, ed+blinkwatch_opera.com, dglazkov+blink, apavlov+blink_chromium.org, darktears, rune+blink, rwlbuis
Visibility:
Public.

Description

CSSParserString::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. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -3 lines) Patch
M Source/core/css/CSSParserValues.h View 1 1 chunk +5 lines, -3 lines 0 comments Download
M Source/core/css/CSSParserValuesTest.cpp View 1 2 3 1 chunk +28 lines, -0 lines 0 comments Download

Messages

Total messages: 12 (0 generated)
tasak
6 years, 9 months ago (2014-03-07 06:30:29 UTC) #1
esprehn
It's weird we can't just use the equalIgnoringCase that StringImpl uses to compare to LChar* ...
6 years, 9 months ago (2014-03-07 07:05:52 UTC) #2
abarth-chromium
On 2014/03/07 07:05:52, esprehn wrote: > It's weird we can't just use the equalIgnoringCase that ...
6 years, 9 months ago (2014-03-07 07:22:10 UTC) #3
abarth-chromium
Why no test?
6 years, 9 months ago (2014-03-07 07:22:21 UTC) #4
tasak
Thank you for reviewing. I have just added unit tests for this. https://codereview.chromium.org/189843005/diff/1/Source/core/css/CSSParserValues.h File Source/core/css/CSSParserValues.h ...
6 years, 9 months ago (2014-03-07 09:55:49 UTC) #5
tasak
On 2014/03/07 09:55:49, tasak wrote: > Thank you for reviewing. > > I have just ...
6 years, 9 months ago (2014-03-10 02:08:03 UTC) #6
tasak
On 2014/03/10 02:08:03, tasak wrote: > On 2014/03/07 09:55:49, tasak wrote: > > Thank you ...
6 years, 9 months ago (2014-03-10 08:23:22 UTC) #7
tasak
> [ RUN ] CSSParserValuesTest.EqualIgnoringCase8BitsString > ../../third_party/WebKit/Source/core/css/CSSParserValuesTest.cpp:64: Failure > Value of: cssParserString.equalIgnoringCase("shadow") > Actual: false ...
6 years, 9 months ago (2014-03-10 09:28:47 UTC) #8
dglazkov
lgtm
6 years, 9 months ago (2014-03-10 19:16:49 UTC) #9
dglazkov
The CQ bit was checked by dglazkov@chromium.org
6 years, 9 months ago (2014-03-10 19:16:53 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tasak@google.com/189843005/60001
6 years, 9 months ago (2014-03-10 19:17:06 UTC) #11
commit-bot: I haz the power
6 years, 9 months ago (2014-03-10 19:17:24 UTC) #12
Message was sent while issue was closed.
Change committed as 168853

Powered by Google App Engine
This is Rietveld 408576698