mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Add stack-overflow check for Array.prototype.{flat, flatMap} (#4899)
This patch fixes #4890 JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
This commit is contained in:
parent
42523bd6e2
commit
bcc711e731
4
.github/workflows/gh-actions.yml
vendored
4
.github/workflows/gh-actions.yml
vendored
@ -162,7 +162,7 @@ jobs:
|
||||
- run: >-
|
||||
$RUNNER -q --jerry-tests
|
||||
--buildoptions=--stack-limit=0,--compile-flag=-fsanitize=address,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--compile-flag=-O2,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold
|
||||
--skip-list=parser-oom.js,parser-oom2.js,stack-limit.js,regression-test-issue-2190.js,regression-test-issue-2258-2963.js,regression-test-issue-2448.js,regression-test-issue-2905.js,regression-test-issue-3785.js,proxy-evil-recursion.js
|
||||
--skip-list=parser-oom.js,parser-oom2.js,stack-limit.js,regression-test-issue-4890.js,regression-test-issue-2190.js,regression-test-issue-2258-2963.js,regression-test-issue-2448.js,regression-test-issue-2905.js,regression-test-issue-3785.js,proxy-evil-recursion.js
|
||||
|
||||
ASAN_Tests_Debug:
|
||||
runs-on: ubuntu-latest
|
||||
@ -175,7 +175,7 @@ jobs:
|
||||
- run: >-
|
||||
$RUNNER -q --jerry-tests --build-debug
|
||||
--buildoptions=--stack-limit=0,--compile-flag=-fsanitize=address,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--compile-flag=-O2,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold
|
||||
--skip-list=parser-oom.js,parser-oom2.js,stack-limit.js,regression-test-issue-2190.js,regression-test-issue-2258-2963.js,regression-test-issue-2448.js,regression-test-issue-2905.js,regression-test-issue-3785.js,proxy-evil-recursion.js
|
||||
--skip-list=parser-oom.js,parser-oom2.js,stack-limit.js,regression-test-issue-4890.js,regression-test-issue-2190.js,regression-test-issue-2258-2963.js,regression-test-issue-2448.js,regression-test-issue-2905.js,regression-test-issue-3785.js,proxy-evil-recursion.js
|
||||
|
||||
UBSAN_Tests:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
#include "jrt.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
@ -2659,6 +2660,8 @@ ecma_builtin_array_flatten_into_array (ecma_value_t target, /**< target will con
|
||||
ecma_value_t mapped_value, /**< mapped value */
|
||||
ecma_value_t thisArg) /**< this arg */
|
||||
{
|
||||
ECMA_CHECK_STACK_USAGE ();
|
||||
|
||||
/* 7. */
|
||||
ecma_length_t target_index = start;
|
||||
|
||||
|
||||
23
tests/jerry/es.next/regression-test-issue-4890.js
Normal file
23
tests/jerry/es.next/regression-test-issue-4890.js
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
let array = new Array(1);
|
||||
array.splice(1, 0, array);
|
||||
|
||||
try {
|
||||
array.flat(Infinity);
|
||||
assert(false);
|
||||
} catch (e) {
|
||||
assert(e instanceof RangeError)
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user