Bug 253272
| Summary: | s_maxSize should be 'unsigned' rather than 'int' in WidthCache.h | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | ap, bfulgham, ggaren, mmaxfield, ntim, simon.fraser, webkit-bug-importer, zalan |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Ahmad Saleem
Hi Team,
I noticed that 's_maxSize' is int and it means that it can be negative while I think cache should be 0 or positive for which we should have it as 'unsigned'.
WebKit Source - https://searchfox.org/wubkat/source/Source/WebCore/platform/graphics/WidthCache.h#217
static const int s_maxSize = 500000;
Appreciate if someone can confirm my understanding and I am happy to do PR to fix it.
Thanks!
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Ahmad Saleem
Just noticed that above - https://searchfox.org/wubkat/source/Source/WebCore/platform/graphics/WidthCache.h#204
There is this as well, where size() is unsigned in HashMap.h:
m_map.size() < s_maxSize
https://searchfox.org/wubkat/source/Source/WTF/wtf/HashMap.h#267
So we are comparing 'unsigned' with 'int'.
Myles C. Maxfield
Yes, the thing it's compared to is an unsigned, so it should be an unsigned too.
Ahmad Saleem
PR - https://github.com/WebKit/WebKit/pull/11082
EWS
Committed 261252@main (315cbcb64568): <https://commits.webkit.org/261252@main>
Reviewed commits have been landed. Closing PR #11082 and removing active labels.
Radar WebKit Bug Importer
<rdar://problem/106270278>