[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 13:49:58 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=187042

Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |darin at apple.com

--- Comment #12 from Darin Adler <darin 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.

-- 
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/4f62e612/attachment.html>


More information about the webkit-unassigned mailing list