Generated garbage code will make negative sized arrays

This commit is contained in:
Adam
2016-02-27 14:53:02 -05:00
parent 1d2a7ba82c
commit fc82bb8a21

View File

@@ -109,6 +109,11 @@ public class Value
else
{
int len = (int) length.getValue();
// the generated garbage code can create negative sized arrays
if (len < 0 || len > 0xFFFF)
len = 0;
Value[] array = new Value[len];
Arrays.fill(array, NULL);
return new Value(array);