[webkit-reviews] review denied: [Bug 192853] stringProtoFuncRepeatCharacter overflow is not caught with 16-bit character times 2**30 : [Attachment 357741] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Dec 19 16:00:24 PST 2018
Mark Lam <mark.lam at apple.com> has denied review:
Bug 192853: stringProtoFuncRepeatCharacter overflow is not caught with 16-bit
character times 2**30
https://bugs.webkit.org/show_bug.cgi?id=192853
Attachment 357741: Patch
https://bugs.webkit.org/attachment.cgi?id=357741&action=review
--- Comment #7 from Mark Lam <mark.lam at apple.com> ---
Comment on attachment 357741
--> https://bugs.webkit.org/attachment.cgi?id=357741
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=357741&action=review
>>> Source/WTF/wtf/text/StringImpl.cpp:196
>>> + if (length > std::min(static_cast<size_t>(MaxLength),
(std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) /
sizeof(CharacterType)))
>>
>> Would it be possible to use a template function like this?
>>
>> template<typename CharacterType>
>> constexpr size_t maxUtf8Length() { return
std::min(static_cast<size_t>(MaxLength), (std::numeric_limits<unsigned>::max()
- sizeof(StringImpl)) / sizeof(CharacterType)); }
>>
>> constexpr would be nice, but if that doesn't work, just change it to inline
instead. This allows you to define this limit in one place instead of 3.
>
> I forgot: this should be a static method.
Wait a minute. I don't get this. Why take the min of MaxLength and
(std::numeric_limits<unsigned>::max() - sizeof(StringImpl))?
More information about the webkit-reviews
mailing list