Skip to content

Stack-overflow in JS_CallInternal #775

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

Closed
Hanseltu opened this issue Dec 29, 2024 · 1 comment · Fixed by #778
Closed

Stack-overflow in JS_CallInternal #775

Hanseltu opened this issue Dec 29, 2024 · 1 comment · Fixed by #778

Comments

@Hanseltu
Copy link

Hi,

The following test input (input.js) causes the qjs a stack-overflow issue.

$cat input.js
function f()	{
f(1,2,3)
}
f(1)

$./qjs input.js
ASAN:DEADLYSIGNAL
=================================================================
==8279==ERROR: AddressSanitizer: stack-overflow on address 0x7fffff7fe5d8 (pc 0x55555572c03a bp 0x7fffff8004a0 sp 0x7fffff7fe580 T0)
    #0 0x55555572c039 in JS_CallInternal /home/benchmarks/quickjs/quickjs.c:14853
    #1 0x5555557341de in JS_CallInternal /home/benchmarks/quickjs/quickjs.c:15304
    #2 0x5555557341de in JS_CallInternal /home/benchmarks/quickjs/quickjs.c:15304
    ...... // omit the same stack trace infomration
    #249 0x5555557341de in JS_CallInternal /home/benchmarks/quickjs/quickjs.c:15304
    #250 0x5555557341de in JS_CallInternal /home/benchmarks/quickjs/quickjs.c:15304

SUMMARY: AddressSanitizer: stack-overflow /home/benchmarks/quickjs/quickjs.c:14853 in JS_CallInternal
==8279==ABORTING

Compilation command: cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-fsanitize=address -ldl -static-libasan" -DCMAKE_INSTALL_PREFIX=/home/benchmarks/quickjs/build .. and make -j12.
Compiler version: gcc-7.5.0.
System: ubuntu 18.04.
quickjs version: master (74fd4d7).

Thanks.

@gengjiawen
Copy link

This looks like the right behavior for the code. V8 behave the same.

bnoordhuis added a commit to bnoordhuis/quickjs that referenced this issue Dec 29, 2024
Otherwise recursive calls keep going until they trip ASan checks.

Remove the `__ASAN__` and `__UBSAN__` defines; no longer necessary.

Remove `globalThis.__running_with_sanitizer__` from qjs; likewise.

Fixes: quickjs-ng#671
Fixes: quickjs-ng#775
Fixes: quickjs-ng#776
bluesky950520 pushed a commit to bluesky950520/quickjs that referenced this issue Mar 14, 2025
Otherwise recursive calls keep going until they trip ASan checks.

Remove the `__ASAN__` and `__UBSAN__` defines; no longer necessary.

Remove `globalThis.__running_with_sanitizer__` from qjs; likewise.

Fixes: quickjs-ng/quickjs#671
Fixes: quickjs-ng/quickjs#775
Fixes: quickjs-ng/quickjs#776
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants