[Webkit-unassigned] [Bug 187042] RegExp.exec returns wrong value with a long integer quantifier
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Jul 1 14:17:52 PDT 2018
https://bugs.webkit.org/show_bug.cgi?id=187042
--- Comment #13 from Mark Lam <mark.lam at apple.com> ---
Comment on attachment 344052
--> https://bugs.webkit.org/attachment.cgi?id=344052
Forgot to update ChangeLog
View in context: https://bugs.webkit.org/attachment.cgi?id=344052&action=review
>>> Source/JavaScriptCore/yarr/YarrParser.h:985
>>> + }
>>
>> This extra overflow check is not needed because in the overflow case: 1. we still need to interate all digits anyway, and the cost of the computation of n is not that expensive, and 2. overflows rarely happen. We should favor the normal (non-overflow) case by not adding extra overflow checks to it.
>
> So this loop should just be this:
>
> while (peekIsDigit())
> n = n * 10 + consumeDigit();
>
> Then the whole function will just be four lines long, just like the original version. And more straightforward than the original, too.
Oh, that's even better. I didn't think to use consumeDigit() but that is totally the way to go.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180701/5c7e793e/attachment.html>
More information about the webkit-unassigned
mailing list