An issue found in Cesanta MJS v.1.26 allows a local attacker to cause a denial of service via the mjs_execute function in mjs.c.
cpe:2.3:a:cesanta:mjs:1.26:*:*:*:*:*:*:*
25C97820-C80A-41CE-B510-F292D2AF665E
OR
Invalid memory read in mjs at function mjs_execute in mjs.c:9320.

## Environment
Ubuntu 18.04, 64 bit

## Steps to reproduce
1. download file
```
git clone https://github.com/cesanta/mjs.git mjs
cd mjs
git checkout d6c06a6
```
2. compile libming with ASAN
```
clang -fsanitize=address mjs.c -o mjs_asan
```
3. command for reproducing the error
```
./mjs_asan -f poc
```
Download poc: 
[mjs_invalid-memory-read_mjs9320.zip](https://github.com/cesanta/mjs/files/11038279/mjs_invalid-memory-read_mjs9320.zip)

## ASAN report
```
> ./mjs_asan -f mjs_invalid-memory-read_mjs9320
AddressSanitizer:DEADLYSIGNAL
=================================================================
==23749==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000050e0d0 bp 0x7ffdec19de70 sp 0x7ffdec19dcb0 T0)
==23749==The signal is caused by a WRITE memory access.
==23749==Hint: address points to the zero page.
    #0 0x50e0d0 in mjs_execute /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9320:46
    #1 0x50c2ce in mjs_exec_internal /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9503:5
    #2 0x50c410 in mjs_exec_file /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9526:11
    #3 0x50f8df in main /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:11783:13
    #4 0x7fe50601e082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
    #5 0x41c3cd in _start (/home/fzz/Desktop/STFGFuzz/Programs/mjs-issues-57/seeds_crash/mjs_asan+0x41c3cd)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9320:46 in mjs_execute
==23749==ABORTING
```
Invalid memory read in mjs_execute() at mjs.c:9320
This is a GitHub Issue
repo:mjs
owner:cesanta
Title : Invalid memory read in mjs_execute() at mjs.c:9320
Issue date:

--- start body ---
Invalid memory read in mjs at function mjs_execute in mjs.c:9320.

## Environment
Ubuntu 18.04, 64 bit

## Steps to reproduce
1. download file
```
git clone https://github.com/cesanta/mjs.git mjs
cd mjs
git checkout d6c06a6
```
2. compile libming with ASAN
```
clang -fsanitize=address mjs.c -o mjs_asan
```
3. command for reproducing the error
```
./mjs_asan -f poc
```
Download poc: 
[mjs_invalid-memory-read_mjs9320.zip](https://github.com/cesanta/mjs/files/11038279/mjs_invalid-memory-read_mjs9320.zip)

## ASAN report
```
> ./mjs_asan -f mjs_invalid-memory-read_mjs9320
AddressSanitizer:DEADLYSIGNAL
=================================================================
==23749==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000050e0d0 bp 0x7ffdec19de70 sp 0x7ffdec19dcb0 T0)
==23749==The signal is caused by a WRITE memory access.
==23749==Hint: address points to the zero page.
    #0 0x50e0d0 in mjs_execute /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9320:46
    #1 0x50c2ce in mjs_exec_internal /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9503:5
    #2 0x50c410 in mjs_exec_file /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9526:11
    #3 0x50f8df in main /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:11783:13
    #4 0x7fe50601e082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
    #5 0x41c3cd in _start (/home/fzz/Desktop/STFGFuzz/Programs/mjs-issues-57/seeds_crash/mjs_asan+0x41c3cd)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /root/compiler1804/aflgo_dataset/mjs-issues-57/mjs.c:9320:46 in mjs_execute
==23749==ABORTING
```
--- end body ---

comments :
--- start comments ---

--- end comments ---