An issue was discovered in mjs (mJS: Restricted JavaScript engine), ES6 (JavaScript version 6). There is NULL pointer dereference in getprop_builtin_foreign() in mjs.c.
cpe:2.3:a:cesanta:mjs:*:*:*:*:*:*:*:*
13B1A3EF-A920-4FB4-BD11-F97092B362F7
2.20.0
OR
System info:  
Ubuntu 16.04.6 LTS, X64, gcc 5.4.0, mjs (latest master 4c870e5)  
I think it is probably a similar issue as  [#114](https://github.com/cesanta/mjs/issues/114) 
Compile Command:
```
$ gcc -fsanitize=address -fno-omit-frame-pointer -DMJS_MAIN mjs.c -ldl -g -o mjs
```
Run Command:
```
$ mjs -f $POC
```
POC file:  
https://github.com/Clingto/POC/blob/master/MSA/mjs/mjs-9187-getprop_builtin_foreign-null-pointer-deref


ASAN info:
```C
ASAN:SIGSEGV
=================================================================
==9391==ERROR: AddressSanitizer: SEGV on unknown address 0x000004a7dc5d (pc 0x000000423a8c bp 0x7ffe565a5270 sp 0x7ffe565a51b0 T0)
    #0 0x423a8b in getprop_builtin_foreign  test/mjs-uaf/build_asan/mjs.c:9298
    #1 0x42407e in getprop_builtin  test/mjs-uaf/build_asan/mjs.c:9335
    #2 0x424c51 in mjs_execute  test/mjs-uaf/build_asan/mjs.c:9485
    #3 0x4265f1 in mjs_exec_internal  test/mjs-uaf/build_asan/mjs.c:9866
    #4 0x426873 in mjs_exec_file  test/mjs-uaf/build_asan/mjs.c:9889
    #5 0x431348 in main  test/mjs-uaf/build_asan/mjs.c:12228
    #6 0x7febbe9ac82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #7 0x401af8 in _start ( test/mjs-uaf/bin_asan/bin/mjs_bin+0x401af8)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV  test/mjs-uaf/build_asan/mjs.c:9298 getprop_builtin_foreign
==9391==ABORTING

```

A NULL pointer dereference in the function getprop_builtin_foreign() mjs.c:9298
This is a GitHub Issue
repo:mjs
owner:cesanta
Title : A NULL pointer dereference in the function getprop_builtin_foreign() mjs.c:9298
Issue date:

--- start body ---
System info:  
Ubuntu 16.04.6 LTS, X64, gcc 5.4.0, mjs (latest master 4c870e5)  
I think it is probably a similar issue as  [#114](https://github.com/cesanta/mjs/issues/114) 
Compile Command:
```
$ gcc -fsanitize=address -fno-omit-frame-pointer -DMJS_MAIN mjs.c -ldl -g -o mjs
```
Run Command:
```
$ mjs -f $POC
```
POC file:  
https://github.com/Clingto/POC/blob/master/MSA/mjs/mjs-9187-getprop_builtin_foreign-null-pointer-deref


ASAN info:
```C
ASAN:SIGSEGV
=================================================================
==9391==ERROR: AddressSanitizer: SEGV on unknown address 0x000004a7dc5d (pc 0x000000423a8c bp 0x7ffe565a5270 sp 0x7ffe565a51b0 T0)
    #0 0x423a8b in getprop_builtin_foreign  test/mjs-uaf/build_asan/mjs.c:9298
    #1 0x42407e in getprop_builtin  test/mjs-uaf/build_asan/mjs.c:9335
    #2 0x424c51 in mjs_execute  test/mjs-uaf/build_asan/mjs.c:9485
    #3 0x4265f1 in mjs_exec_internal  test/mjs-uaf/build_asan/mjs.c:9866
    #4 0x426873 in mjs_exec_file  test/mjs-uaf/build_asan/mjs.c:9889
    #5 0x431348 in main  test/mjs-uaf/build_asan/mjs.c:12228
    #6 0x7febbe9ac82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #7 0x401af8 in _start ( test/mjs-uaf/bin_asan/bin/mjs_bin+0x401af8)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV  test/mjs-uaf/build_asan/mjs.c:9298 getprop_builtin_foreign
==9391==ABORTING

```

--- end body ---

comments :
--- start comments ---

--- end comments ---