From 87656a3e9a5d679b8bc9921087e5ac3848167345 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Fri, 26 Apr 2019 12:41:17 +0300 Subject: [PATCH] C backend: fix array of of bounds access in fibers --- core/src/main/java/org/teavm/runtime/Fiber.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/teavm/runtime/Fiber.java b/core/src/main/java/org/teavm/runtime/Fiber.java index 0a06c388c..a36024ece 100644 --- a/core/src/main/java/org/teavm/runtime/Fiber.java +++ b/core/src/main/java/org/teavm/runtime/Fiber.java @@ -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;