WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
57552
Find client not told when WKPageCountStringMatches exceeds maximum
https://bugs.webkit.org/show_bug.cgi?id=57552
Summary
Find client not told when WKPageCountStringMatches exceeds maximum
John Sullivan
Reported
2011-03-31 08:44:26 PDT
If the number of string matches on a page exceeds the maximum passed to WKPageCountStringMatches, the callback will report the passed maximum, rather than the special value kWKMoreThanMaximumMatchCount.
Attachments
Patch that uses the same technique as the find-string case.
(1.50 KB, text/plain)
2011-03-31 08:46 PDT
,
John Sullivan
no flags
Details
Take two, featuring non-degenerate ChangeLog entry.
(1.71 KB, patch)
2011-03-31 08:49 PDT
,
John Sullivan
no flags
Details
Formatted Diff
Diff
Take three, now handles numeric_limits<unsigned>::max()
(2.52 KB, patch)
2011-03-31 10:04 PDT
,
John Sullivan
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
John Sullivan
Comment 1
2011-03-31 08:46:21 PDT
Created
attachment 87732
[details]
Patch that uses the same technique as the find-string case.
John Sullivan
Comment 2
2011-03-31 08:47:21 PDT
Comment on
attachment 87732
[details]
Patch that uses the same technique as the find-string case. Oops, forgot to save the ChangeLog before creating the patch. New one coming up shortly.
John Sullivan
Comment 3
2011-03-31 08:48:12 PDT
In Radar as <
rdar://problem/9214824
>
John Sullivan
Comment 4
2011-03-31 08:49:43 PDT
Created
attachment 87733
[details]
Take two, featuring non-degenerate ChangeLog entry.
Adam Roben (:aroben)
Comment 5
2011-03-31 08:53:46 PDT
Comment on
attachment 87733
[details]
Take two, featuring non-degenerate ChangeLog entry. View in context:
https://bugs.webkit.org/attachment.cgi?id=87733&action=review
> Source/WebKit2/WebProcess/WebPage/FindController.cpp:72 > void FindController::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount) > { > - unsigned matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), false, maxMatchCount); > + unsigned matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), false, maxMatchCount + 1); > m_webPage->corePage()->unmarkAllTextMatches(); > > + // Check if we have more matches than allowed. > + if (matchCount > maxMatchCount) > + matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
Do we need to worry about someone passing numeric_limits<unsigned>::max() as the maxMatchCount argument to this function? That would result in underflow.
Darin Adler
Comment 6
2011-03-31 09:15:50 PDT
Comment on
attachment 87733
[details]
Take two, featuring non-degenerate ChangeLog entry. View in context:
https://bugs.webkit.org/attachment.cgi?id=87733&action=review
>> Source/WebKit2/WebProcess/WebPage/FindController.cpp:72 >> + matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount); > > Do we need to worry about someone passing numeric_limits<unsigned>::max() as the maxMatchCount argument to this function? That would result in underflow.
I think you probably mean overflow, resulting in the number 0. An easy way to handle that overflow would be changing max() to max() - 1.
John Sullivan
Comment 7
2011-03-31 09:58:47 PDT
I'll fix the max() case for both this function and findMatchesForString() and submit another patch.
John Sullivan
Comment 8
2011-03-31 10:04:46 PDT
Created
attachment 87754
[details]
Take three, now handles numeric_limits<unsigned>::max()
Adam Roben (:aroben)
Comment 9
2011-03-31 10:06:52 PDT
Comment on
attachment 87733
[details]
Take two, featuring non-degenerate ChangeLog entry. View in context:
https://bugs.webkit.org/attachment.cgi?id=87733&action=review
>>> Source/WebKit2/WebProcess/WebPage/FindController.cpp:72 >>> + matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount); >> >> Do we need to worry about someone passing numeric_limits<unsigned>::max() as the maxMatchCount argument to this function? That would result in underflow. > > I think you probably mean overflow, resulting in the number 0. > > An easy way to handle that overflow would be changing max() to max() - 1.
Right, overflow!
John Sullivan
Comment 10
2011-03-31 10:40:00 PDT
Fixed in <
http://trac.webkit.org/changeset/82594
>.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug