eclipsesource / eclipsesource/J2V8

How to protect the JVM from (intentional) OOMs ?

Open
#428 4 comments 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
Java
Stars
2.6k
Forks
387
PR merge metrics
No merged PRs in 30d

Description

Hi,
It is very easy to write a small script that will go OOM in the JS layer, causing the JVM to crash.
For instance the following script :
```javascript
var longstring="ec2ca74c-d91b-11e8-9e1d-db5bb294a325-ec2da822-d91b-11e8-afde-9b50161507bc-ec2ea02e-d91b-11e8-991e-73331350b545-ec2f9c90-d91b-11e8-8aa8-ff3f319915e9-ec309a28-d91b-11e8-a5ae-af9279087141-ec3197ca-d91b-11e8-ac5f-3b03eee727e2-ec329b02-d91b-11e8-9c93";
var a = [];
while (true) {
a.push(longstring);
}
```
Will end up with following abort :
```
#
# Fatal javascript OOM in invalid array length
#
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGILL (0x4) at pc=0x00007fa15f938409, pid=28270, tid=0x00007fa1641d7700
```
Are there ways of protecting the JVM from exiting due to an abortion in the V8 library ?
Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.