Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index out of bounds: the len is 2 but the index is 2 #3972

Open
malezjaa opened this issue Aug 27, 2024 · 2 comments
Open

index out of bounds: the len is 2 but the index is 2 #3972

malezjaa opened this issue Aug 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@malezjaa
Copy link

Describe the bug

thread 'main' panicked at C:\Users\PC\.cargo\git\checkouts\boa-a4b8a5f0b6a5c7b3\25705ef\core\engine\src\environments\runtime\mod.rs:652:57:
index out of bounds: the len is 2 but the index is 2
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `C:\dev\ike\ike\target\debug\ike.exe run` (exit code: 1)
const headers = new Headers([
  ['Content-Type', ['application/json', 'dwa']]
])

console.log(headers.get("Content-Type"))

headers.get panics. It's caused by getArgument which normally works.

For example something like this works:

const atob = (data) => {
    const argument = getArgument(data, "data", "atob");
    const string = toString(argument);

    try {
        return atob_ex(string);
    } catch (error) {
        throw new Error(`atob: Failed to decode base64 string: ${error}`);
    }
};

To Reproduce
https://gist.github.com/malezjaa/3bbad912396e71ebf8a384aae134fee7

Expected behavior
To work.

Build environment (please complete the following information):

  • OS: Windows 11
  • Rustc version: rustc 1.82.0-nightly (41dd149fd 2024-08-11)
@malezjaa malezjaa added the bug Something isn't working label Aug 27, 2024
@jedel1043
Copy link
Member

jedel1043 commented Sep 2, 2024

Can you share a bit more info about your setup? I see that the gist uses a @std namespace on imports, and the issue doesn't mention how those are implemented.

@malezjaa
Copy link
Author

malezjaa commented Sep 2, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants