mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibJS: Check validity of computed_property_name() result before using it
This fixes two cases obj[expr] and obj[expr]() (MemberExpression and CallExpression respectively) when expr throws an exception and results in an empty value, causing a crash by passing the invalid PropertyName created by computed_property_name() to Object::get() without checking it first. Fixes #3459.
This commit is contained in:
parent
75dac35d0e
commit
568d53c9b1
Notes:
sideshowbarker
2024-07-19 02:44:41 +09:00
Author: https://github.com/linusg
Commit: 568d53c9b1
Pull-request: https://github.com/SerenityOS/serenity/pull/3461
Issue: https://github.com/SerenityOS/serenity/issues/3459
3 changed files with 17 additions and 3 deletions
8
Libraries/LibJS/Tests/computed-property-throws.js
Normal file
8
Libraries/LibJS/Tests/computed-property-throws.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
test("Issue #3459, exception in computed property expression", () => {
|
||||
expect(() => {
|
||||
"foo"[bar];
|
||||
}).toThrow(ReferenceError);
|
||||
expect(() => {
|
||||
"foo"[bar]();
|
||||
}).toThrow(ReferenceError);
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
test("Issue #1992, exception thrown in catch {} block", () => {
|
||||
test("Issue #3437, exception thrown in catch {} block", () => {
|
||||
var tryHasBeenExecuted = false;
|
||||
var catchHasBeenExecuted = false;
|
||||
var finallyHasBeenExecuted = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue