diff --git a/src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java b/src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java index a47b2d8300..e43029d459 100644 --- a/src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java +++ b/src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java @@ -154,7 +154,7 @@ public final class POIFSDocument implements POIFSViewable, Iterable } } - return (int)length; + return Math.toIntExact(length); } /** diff --git a/src/java/org/apache/poi/poifs/property/RootProperty.java b/src/java/org/apache/poi/poifs/property/RootProperty.java index 3cb4a6e43b..c74a02a29d 100644 --- a/src/java/org/apache/poi/poifs/property/RootProperty.java +++ b/src/java/org/apache/poi/poifs/property/RootProperty.java @@ -17,6 +17,7 @@ package org.apache.poi.poifs.property; +import org.apache.commons.math3.util.ArithmeticUtils; import org.apache.poi.poifs.common.POIFSConstants; /** @@ -55,7 +56,7 @@ public final class RootProperty extends DirectoryProperty { { final int BLOCK_SHIFT = 6; final int _block_size = 1 << BLOCK_SHIFT; - super.setSize(size * _block_size); + super.setSize(ArithmeticUtils.mulAndCheck(size, _block_size)); } /** diff --git a/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java b/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java index a487b36ec4..a478982021 100644 --- a/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java +++ b/src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java @@ -455,7 +455,7 @@ public class EvaluationConditionalFormatRule implements Comparable