Summary: | String.prototype.replace() should throw an OutOfMemoryError when using too much memory. | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Mark Lam <mark.lam> | ||||||
Component: | JavaScriptCore | Assignee: | Mark Lam <mark.lam> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | benjamin, cdumez, cmarcelo, commit-queue, dbates, fpizlo, ggaren, jfbastien, keith_miller, msaboff, saam, webkit-bug-importer, ysuzuki | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | WebKit Local Build | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
Bug Depends on: | 164125 | ||||||||
Bug Blocks: | |||||||||
Attachments: |
|
Description
Mark Lam
2016-10-25 16:57:04 PDT
Created attachment 292852 [details]
proposed patch.
Comment on attachment 292852 [details] proposed patch. View in context: https://bugs.webkit.org/attachment.cgi?id=292852&action=review > Source/JavaScriptCore/runtime/StringPrototype.cpp:462 > + THROW_AND_RETURN_IF_FAIL(exec, scope, sourceRanges.tryConstructAndAppend(lastIndex, result.start - lastIndex)); I don't really like this idiom because it buries the real code inside the error handling macro. How about this: if (!sourceRanges.tryConstructAndAppend(lastIndex, result.start - lastIndex)) OUT_OF_MEMORY(exec, scope); (In reply to comment #3) > Comment on attachment 292852 [details] > proposed patch. > > View in context: > https://bugs.webkit.org/attachment.cgi?id=292852&action=review > > > Source/JavaScriptCore/runtime/StringPrototype.cpp:462 > > + THROW_AND_RETURN_IF_FAIL(exec, scope, sourceRanges.tryConstructAndAppend(lastIndex, result.start - lastIndex)); > > I don't really like this idiom because it buries the real code inside the > error handling macro. > > How about this: > > if (!sourceRanges.tryConstructAndAppend(lastIndex, result.start - lastIndex)) > OUT_OF_MEMORY(exec, scope); Sure. I'll make the change. Created attachment 292853 [details]
proposed patch.
Comment on attachment 292853 [details]
proposed patch.
r=me
Thanks for the review. Landed in r207861: <http://trac.webkit.org/r207861>. |