Bug 209273 - StringView::startsWith and String::startsWith do not treat null strings the same
Summary: StringView::startsWith and String::startsWith do not treat null strings the same
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-03-19 00:53 PDT by youenn fablet
Modified: 2020-03-23 02:49 PDT (History)
6 users (show)

See Also:


Attachments
Patch (3.65 KB, patch)
2020-03-19 07:13 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2020-03-19 00:53:03 PDT
String::startsWith(null) returns false.
StringView::startsWith(null) returns true.
Both startsWith(emptyString) returns true.
Comment 1 youenn fablet 2020-03-19 07:13:42 PDT
Created attachment 393975 [details]
Patch
Comment 2 Darin Adler 2020-03-22 14:28:35 PDT
Comment on attachment 393975 [details]
Patch

I’m amazed. No one depended on the old behavior!?
Comment 3 youenn fablet 2020-03-23 02:28:05 PDT
(In reply to Darin Adler from comment #2)
> Comment on attachment 393975 [details]
> Patch
> 
> I’m amazed. No one depended on the old behavior!?

I was surprised too.
Looking at our code base though, most of startsWith use null terminated strings as prefix so will not end up in that particular case.
Comment 4 EWS 2020-03-23 02:48:17 PDT
Committed r258828: <https://trac.webkit.org/changeset/258828>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 393975 [details].
Comment 5 Radar WebKit Bug Importer 2020-03-23 02:49:14 PDT
<rdar://problem/60764657>