WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
220130
[YARR JIT] Crash on overflow when compiling /(a{1000000000}b{1000000000}|c{1000000000}|)d{1000000000}e{1000000000}/.test();
https://bugs.webkit.org/show_bug.cgi?id=220130
Summary
[YARR JIT] Crash on overflow when compiling /(a{1000000000}b{1000000000}|c{10...
Mark Lam
Reported
2020-12-23 16:16:07 PST
rdar://69884758
Attachments
proposed patch.
(6.86 KB, patch)
2020-12-23 16:30 PST
,
Mark Lam
msaboff
: review-
Details
Formatted Diff
Diff
Patch
(3.37 KB, patch)
2021-02-23 18:17 PST
,
Michael Saboff
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Mark Lam
Comment 1
2020-12-23 16:30:28 PST
Created
attachment 416731
[details]
proposed patch.
Daniel Bates
Comment 2
2020-12-29 19:13:55 PST
Comment on
attachment 416731
[details]
proposed patch. Seems sane.
Mark Lam
Comment 3
2020-12-29 19:24:49 PST
Thanks. I would still like Michael to take a look before I land, especially on whether I should be using a different error code.
Michael Saboff
Comment 4
2020-12-30 15:22:42 PST
Comment on
attachment 416731
[details]
proposed patch. I spent some time trying the patch. The test case should not cause an overflow. The patch found a bug and through code inspection I found another related bug. If you look at lines ~3107..3111, you'll notice that is "if (!isBegin)" is true, we add the offset from the prior op before subtracting the checked amount for the current op. This is where we overflow with the test and this patch. We should be subtracting the current checked amount before adding the prior. When I made this fix, the offset never overflowed. When I adjust the test to have combined sounds >= 2^32, we overflow in the parser. There is a similar "add before subtract" offset case in lines 2801..2805. In a local build, I change both cases to have the subtract before the add and ran all JSC tests with no issues. We can land this patch, but it is more of a canary for newly introduced bugs in YARR JIT code (after I land my changes). If we do, we should restructure the code to assert no overflow.
Mark Lam
Comment 5
2021-02-02 15:45:34 PST
Michael is going to implement the real fix.
Michael Saboff
Comment 6
2021-02-23 18:02:56 PST
We do some checked math in the Yarr JIT compiler in the wrong order, addition before subtraction causing checked arithmetic overflows.
Michael Saboff
Comment 7
2021-02-23 18:17:53 PST
Created
attachment 421381
[details]
Patch
Yusuke Suzuki
Comment 8
2021-02-23 18:20:02 PST
Comment on
attachment 421381
[details]
Patch r=me
EWS
Comment 9
2021-02-23 21:00:35 PST
Committed
r273371
: <
https://commits.webkit.org/r273371
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 421381
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug