| Summary: | Math.hypot checks for infinite values prematurely | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Richard Gibson <richard.gibson> | ||||
| Component: | JavaScriptCore | Assignee: | Yusuke Suzuki <ysuzuki> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | ews-watchlist, fpizlo, keith_miller, mark.lam, msaboff, ross.kirsling, saam, tzagallo, webkit-bug-importer, ysuzuki | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
Richard Gibson
2021-09-02 16:58:43 PDT
Created attachment 437397 [details]
Patch
Comment on attachment 437397 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=437397&action=review r=me with comments. > Source/JavaScriptCore/ChangeLog:8 > + We should throw an error about non finite argument after coercing all arguments to doubles. Don't forget the spec link. :) https://tc39.es/ecma262/#sec-math.hypot > JSTests/stress/math-hypot-evaluation-ordering.js:18 > +shouldThrow(() => { > + Math.hypot({valueOf(){ return Infinity }}, {valueOf(){ throw new Error("arguments[1]") }}) > +}, `Error: arguments[1]`); I think this test should be upstreamed to test262. Comment on attachment 437397 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=437397&action=review >> Source/JavaScriptCore/ChangeLog:8 >> + We should throw an error about non finite argument after coercing all arguments to doubles. > > Don't forget the spec link. :) > https://tc39.es/ecma262/#sec-math.hypot Added. >> JSTests/stress/math-hypot-evaluation-ordering.js:18 >> +}, `Error: arguments[1]`); > > I think this test should be upstreamed to test262. @Gibson, do you have a plan adding that? Committed r282081 (241381@main): <https://commits.webkit.org/241381@main> Yes, I will submit a test262 PR unless someone beats me to it. Forgot that I'd already done it: https://github.com/tc39/test262/commit/50f3fca7a0eac6b6e8e5e9aee7af3c2a05831261 |