Skip to content

Commit

Permalink
[GR-60698] Backport to 24.1: Fix int overflow in ObjectSizeCalculator…
Browse files Browse the repository at this point in the history
…#increaseByArraySize.

PullRequest: graal/19701
  • Loading branch information
OracleLabsAutomation authored and elkorchi committed Dec 24, 2024
2 parents e51a3da + 2db8306 commit f7241db
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()));
}

Expand Down

0 comments on commit f7241db

Please sign in to comment.