Skip to content

Commit 2db8306

Browse files
jchalouezzarghili
authored andcommitted
Fix int overflow in ObjectSizeCalculator#increaseByArraySize.
(cherry picked from commit 31a7287)
1 parent e51a3da commit 2db8306

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/ObjectSizeCalculator.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ private static final class CalculationState {
188188

189189
/**
190190
* Given an object, returns the allocated size, in bytes, of the object and all other objects
191-
* reachable from it within {@link ObjectSizeCalculator#isContextHeapBoundary(Object) context
192-
* heap boundary}.
191+
* reachable from it within {@link ObjectSizeCalculator#isContextHeapBoundary(APIAccess, Object)
192+
* context heap boundary}.
193193
*
194194
* @param obj the object; cannot be null.
195195
* @param stopAtBytes when calculated size exceeds stopAtBytes, calculation stops and returns
@@ -285,7 +285,7 @@ private static ForcedStop visit(CalculationState calculationState, Object obj) {
285285
}
286286
}
287287

288-
private static void increaseByArraySize(CalculationState calculationState, ArrayMemoryLayout layout, int length) {
288+
private static void increaseByArraySize(CalculationState calculationState, ArrayMemoryLayout layout, long length) {
289289
increaseSize(calculationState, roundToObjectAlignment(layout.baseOffset + length * layout.indexScale, getObjectAlignment()));
290290
}
291291

0 commit comments

Comments
 (0)