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

stack overflow in compute_stack_size_rec #9

Closed
apascovici opened this issue Sep 16, 2020 · 1 comment
Closed

stack overflow in compute_stack_size_rec #9

apascovici opened this issue Sep 16, 2020 · 1 comment

Comments

@apascovici
Copy link

apascovici commented Sep 16, 2020

Problem: given this JS input:

function main() {
const v2 = [1337,NaN,1337];
const v6 = new Int32Array(212559.11688867002);
const v7 = v6.join(v2);
const v8 = eval(v7);
}
main();

the thing crashes with "./qjs a.js"

Suggested fix:

diff --git a/quickjs.c b/quickjs.c
index efc1d54..670f758 100644
--- a/quickjs.c
+++ b/quickjs.c
@@ -31982,6 +31982,8 @@ static __exception int compute_stack_size_rec(JSContext *ctx,
     const JSOpCode *oi;
     const uint8_t *bc_buf;
 
+    if (js_check_stack_overflow(ctx->rt, 0))
+      goto stack_overflow;
@bellard
Copy link
Owner

bellard commented Nov 2, 2020

The real issue is that there should be no stack overflow. It will be fixed in the next release.

@bellard bellard closed this as completed Nov 2, 2020
cykoder pushed a commit to cykoder/quickjs that referenced this issue Sep 1, 2023
fix: correct column number offset when use OPTIMIZE
GerHobbelt pushed a commit to GerHobbelt/quickjs that referenced this issue Oct 17, 2023
GerHobbelt pushed a commit to GerHobbelt/quickjs that referenced this issue Oct 17, 2023
bsekisser pushed a commit to bsekisser/quickjs that referenced this issue Jan 21, 2025
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

No branches or pull requests

2 participants