Bug 225573 - Remove uses of the String::toInt family of functions from the WebCore/svg and WebCore/workers directories
Summary: Remove uses of the String::toInt family of functions from the WebCore/svg and...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-05-08 18:35 PDT by Darin Adler
Modified: 2021-05-09 11:40 PDT (History)
10 users (show)

See Also:


Attachments
Patch (29.67 KB, patch)
2021-05-08 19:04 PDT, Darin Adler
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (30.01 KB, patch)
2021-05-08 20:48 PDT, Darin Adler
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (30.19 KB, patch)
2021-05-08 21:21 PDT, Darin Adler
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2021-05-08 18:35:09 PDT
Remove uses of the String::toInt family of functions from the WebCore/svg and WebCore/workers directories
Comment 1 Darin Adler 2021-05-08 19:04:55 PDT Comment hidden (obsolete)
Comment 2 Darin Adler 2021-05-08 20:48:00 PDT Comment hidden (obsolete)
Comment 3 Darin Adler 2021-05-08 21:21:38 PDT
Created attachment 428111 [details]
Patch
Comment 4 Darin Adler 2021-05-08 21:53:42 PDT
Comment on attachment 428111 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=428111&action=review

> Source/WebCore/svg/SVGToOTFFontConversion.cpp:1456
> +            if (value && *value >= 0 && *value < 1000) {
> +                m_weight = std::max(std::min((*value + 50) / 100, static_cast<int>(std::numeric_limits<uint8_t>::max())), static_cast<int>(std::numeric_limits<uint8_t>::min()));

This std::max/min stuff is not needed. We can’t get a value outside the range 0-255 when we take a number that’s required to be in the range 0-999 and divide it by 100 (with rounding). That gives us a number in the range of 0-10, nowhere near 255, and not less than 0.

I’ll remove it.
Comment 5 Darin Adler 2021-05-09 11:40:25 PDT
Accidentally commit this along at the same time as the fix for bug 225577.

Committed r277245 (237514@main): <https://commits.webkit.org/237514@main>
Comment 6 Radar WebKit Bug Importer 2021-05-09 11:40:35 PDT
<rdar://problem/77717702>