WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
227962
Check for out of memory in JSC::globalFuncEscape() and JSC::globalFuncUnescape().
https://bugs.webkit.org/show_bug.cgi?id=227962
Summary
Check for out of memory in JSC::globalFuncEscape() and JSC::globalFuncUnescap...
Mark Lam
Reported
2021-07-14 11:38:38 PDT
rdar://78392251
Attachments
proposed patch.
(4.66 KB, patch)
2021-07-14 11:41 PDT
,
Mark Lam
ysuzuki
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Mark Lam
Comment 1
2021-07-14 11:41:41 PDT
Created
attachment 433514
[details]
proposed patch.
Yusuke Suzuki
Comment 2
2021-07-14 11:45:14 PDT
Comment on
attachment 433514
[details]
proposed patch. View in context:
https://bugs.webkit.org/attachment.cgi?id=433514&action=review
r=me
> Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp:616 > + return vm.smallStrings.emptyString();
Why not returning `{ }`?
> Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp:679 > + return vm.smallStrings.emptyString();
Why not returning `{ }` ?
Mark Lam
Comment 3
2021-07-14 11:54:00 PDT
(In reply to Yusuke Suzuki from
comment #2
)
> Comment on
attachment 433514
[details]
> proposed patch. > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=433514&action=review
> > r=me
Thanks for the review.
> > Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp:616 > > + return vm.smallStrings.emptyString(); > > Why not returning `{ }`? > > > Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp:679 > > + return vm.smallStrings.emptyString(); > > Why not returning `{ }` ?
Because the return value is for a callback called from toStringView(). I gave returning { } a try and this is what I get: ./runtime/JSGlobalObjectFunctions.cpp:617:20: error: cannot deduce lambda return type from initializer list return { }; ^~~ ./runtime/JSGlobalObjectFunctions.cpp:580:28: error: no matching function for call to 'toStringView' return JSValue::encode(toStringView(globalObject, callFrame->argument(0), [&] (StringView view) { ^~~~~~~~~~~~ I'll just stick with returning the empty string for simplicity.
Mark Lam
Comment 4
2021-07-14 12:05:47 PDT
(In reply to Mark Lam from
comment #3
)
> > > Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp:616 > > > + return vm.smallStrings.emptyString(); > > > > Why not returning `{ }`?
...
> Because the return value is for a callback called from toStringView(). I > gave returning { } a try and this is what I get: > > ./runtime/JSGlobalObjectFunctions.cpp:617:20: error: cannot deduce lambda > return type from initializer list > return { }; > ^~~
On second thought, I can explicitly declare the lambdas as returning JSString*. It will result in a roundabout way of returning an empty JSValue() on 64-bit and a null cell JSValue on 32-bit ... which is kind of inconsistent, but we already apply this treatment when throwing exceptions elsewhere in the code. I'll just do that.
Mark Lam
Comment 5
2021-07-14 12:16:43 PDT
Landed in
r279915
: <
http://trac.webkit.org/r279915
>.
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