cesanta / mjs

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

SEGV on unknown address #260

Open Vincebye opened 3 months ago

Vincebye commented 3 months ago

Environment

Ubuntu 22.04.3 LTS

Affected Version

MJS 2.20.0

Step to reproduce

cd mjs 
git checkout b1b6eac6b1e5b830a5cb14f8f4dc690ef3162551 
export LDFLAGS="-lpthread -latomic" 
./afl-clang -DMJS_MAIN mjs.c -fno-inline -ldl -o mjs-bin -fsanitize=address -g 
./mjs-bin -f poc.js 

Contents of PoCfile

print++;
print(1)

ASAN Report

$ ./mjs-bin poc2.js
AddressSanitizer:DEADLYSIGNAL
=================================================================
==20075==ERROR: AddressSanitizer: stack-overflow on address 0x0000d4006700 (pc 0x55c589a39178 bp 0x7fffd4006ab0 sp 0x0000d4006700 T0)
AddressSanitizer:DEADLYSIGNAL
AddressSanitizer: nested bug in the same thread, aborting.