C backend: fix array of of bounds access in fibers

This commit is contained in:
Alexey Andreev 2019-04-26 12:41:17 +03:00
parent 8cd96d2da2
commit 87656a3e9a

View File

@ -81,7 +81,7 @@ public class Fiber {
public void push(double value) {
if (doubleValues == null) {
doubleValues = new double[4];
} else if (doubleTop + 4 == doubleValues.length) {
} else if (doubleTop + 1 == doubleValues.length) {
doubleValues = Arrays.copyOf(doubleValues, doubleValues.length * 3 / 2);
}
doubleValues[doubleTop++] = value;
@ -90,7 +90,7 @@ public class Fiber {
public void push(Object value) {
if (objectValues == null) {
objectValues = new Object[4];
} else if (objectTop + 4 == objectValues.length) {
} else if (objectTop + 1 == objectValues.length) {
objectValues = Arrays.copyOf(objectValues, objectValues.length * 3 / 2);
}
objectValues[objectTop++] = value;