Skip to content

Rest parameters for arrow functions can panic #1241

Closed

Description

@Razican

The Function::add_rest_param() function can panic with the following error message:

thread 'main' panicked at 'range start index 2 out of range for slice of length 0', boa/src/builtins/function/mod.rs:123:45

This has been observed when running this ECMAScript test.

This is the backtrace:

   0: rust_begin_unwind
             at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/core/src/panicking.rs:92:14
   2: core::slice::index::slice_start_index_len_fail
             at /rustc/88f19c6dab716c6281af7602e30f413e809c5974/library/core/src/slice/index.rs:34:5
   3: boa::builtins::function::Function::add_rest_param
   4: boa::object::gcobject::GcObject::call
   5: <boa::syntax::ast::node::call::Call as boa::exec::Executable>::run
   6: <boa::syntax::ast::node::call::Call as boa::exec::Executable>::run
   7: <boa::syntax::ast::node::call::Call as boa::exec::Executable>::run
   8: <boa::syntax::ast::node::statement_list::StatementList as boa::exec::Executable>::run
   9: boa::context::Context::eval
  10: boa_tester::exec::<impl boa_tester::Test>::run_once
  11: boa_tester::exec::<impl boa_tester::Test>::run
  12: boa_tester::main

You can check this issue by running the following command:

RUST_BACKTRACE=1 cargo run --release --bin boa_tester -- run -v -s test/language/rest-parameters/arrow-function.js

Activity

  1. added
    A-Bug
    C-Builtins
    A-Execution
    on May 9, 2021
  2. added this to the v0.12.0 milestone on May 9, 2021
  3. modified the milestones: v0.12.0, v0.13.0 on May 22, 2021
  4. modified the milestones: v0.13.0, v0.12.0 on May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-BugA-ExecutionC-Builtins

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions