From 31a7287b1e3680013990fd83a75f70b5f719ab34 Mon Sep 17 00:00:00 2001 From: Jakub Chaloupka Date: Fri, 20 Dec 2024 16:37:51 +0100 Subject: [PATCH] Fix int overflow in ObjectSizeCalculator#increaseByArraySize. --- .../com/oracle/truffle/polyglot/ObjectSizeCalculator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/ObjectSizeCalculator.java b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/ObjectSizeCalculator.java index 6f6480bc80ee..f51a26e37665 100644 --- a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/ObjectSizeCalculator.java +++ b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/ObjectSizeCalculator.java @@ -188,8 +188,8 @@ private static final class CalculationState { /** * Given an object, returns the allocated size, in bytes, of the object and all other objects - * reachable from it within {@link ObjectSizeCalculator#isContextHeapBoundary(Object) context - * heap boundary}. + * reachable from it within {@link ObjectSizeCalculator#isContextHeapBoundary(APIAccess, Object) + * context heap boundary}. * * @param obj the object; cannot be null. * @param stopAtBytes when calculated size exceeds stopAtBytes, calculation stops and returns @@ -285,7 +285,7 @@ private static ForcedStop visit(CalculationState calculationState, Object obj) { } } - private static void increaseByArraySize(CalculationState calculationState, ArrayMemoryLayout layout, int length) { + private static void increaseByArraySize(CalculationState calculationState, ArrayMemoryLayout layout, long length) { increaseSize(calculationState, roundToObjectAlignment(layout.baseOffset + length * layout.indexScale, getObjectAlignment())); }