-
Notifications
You must be signed in to change notification settings - Fork 218
Closed
Description
./build/qjs
QuickJS-ng - Type ".help" for help
qjs >
RangeError: Maximum call stack size exceeded
at ucs_length (<null>:0:0)
at readline_print_prompt (<null>:0:0)
at readline_start (<null>:0:0)
at cmd_readline_start (<null>:0:0)
at readline_handle_cmd (<null>:0:0)
at handle_key (<null>:0:0)
at handle_char (<null>:0:0)
at handle_byte (<null>:0:0)
at term_read_handler (<null>:0:0)
I also needed this patch in order to make it that far, or ASAN trips:
diff --git a/quickjs.c b/quickjs.c
index 22285d7..8d00d6f 100644
--- a/quickjs.c
+++ b/quickjs.c
@@ -6529,7 +6529,7 @@ static void build_backtrace(JSContext *ctx, JSValue error_obj,
line_num1 = find_line_num(ctx, b,
sf->cur_pc - b->byte_code_buf - 1,
&col_num1);
- atom_str = JS_AtomToCString(ctx, b->filename);
+ atom_str = b->filename ? JS_AtomToCString(ctx, b->filename) : NULL;
dbuf_printf(&dbuf, " (%s", atom_str ? atom_str : "<null>");
JS_FreeCString(ctx, atom_str);
if (line_num1 != -1)
ASAN error:
=================================================================
==89091==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000107900ab8 at pc 0x00010522ef0c bp 0x00016b4b79c0 sp 0x00016b4b7150
READ of size 1 at 0x000107900ab8 thread T0
#0 0x10522ef08 in printf_common(void*, char const*, char*)+0x84c (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x22f08)
#1 0x10522f2d8 in wrap_vsnprintf+0xac (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x232d8)
#2 0x1049126fc in dbuf_printf cutils.c:189
#3 0x104a2777c in build_backtrace quickjs.c:6533
#4 0x104a230c0 in JS_CallInternal quickjs.c:17111
#5 0x1049f1c4c in JS_CallInternal quickjs.c:15035
#6 0x1049f1c4c in JS_CallInternal quickjs.c:15035
#7 0x1049f1c4c in JS_CallInternal quickjs.c:15035
#8 0x1049f1c4c in JS_CallInternal quickjs.c:15035
#9 0x1049f1c4c in JS_CallInternal quickjs.c:15035
#10 0x1049f1c4c in JS_CallInternal quickjs.c:15035
#11 0x1049f1c4c in JS_CallInternal quickjs.c:15035
#12 0x1049f1c4c in JS_CallInternal quickjs.c:15035
#13 0x1049e2c08 in JS_Call quickjs.c:17159
#14 0x1048f2500 in call_handler quickjs-libc.c:2160
#15 0x1048f04f8 in js_os_poll quickjs-libc.c:2403
#16 0x1048dc55c in js_std_loop quickjs-libc.c:4020
#17 0x1048d2e58 in main qjs.c:526
#18 0x1a4b2bf24 (<unknown module>)
0x000107900ab8 is located 0 bytes after 40-byte region [0x000107900a90,0x000107900ab8)
allocated by thread T0 here:
#0 0x10525f244 in wrap_malloc+0x94 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x53244)
#1 0x104a798b0 in js_def_malloc quickjs.c:1707
#2 0x1049748f8 in js_malloc_rt quickjs.c:1377
#3 0x104974a8c in js_mallocz_rt quickjs.c:1404
#4 0x104996ec4 in __JS_NewAtom quickjs.c:2748
#5 0x10499b134 in __JS_NewAtomInit quickjs.c:2848
#6 0x104976c30 in JS_InitAtoms quickjs.c:2600
#7 0x1049761c8 in JS_NewRuntime2 quickjs.c:1652
#8 0x10497d0a0 in JS_NewRuntime quickjs.c:1763
#9 0x1048d29c0 in main qjs.c:465
#10 0x1a4b2bf24 (<unknown module>)
Not sure if legit bug or shenanigans...
Metadata
Metadata
Assignees
Labels
No labels