mirror of https://github.com/apache/poi.git
some more checks for int overflows
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1857609 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c56ebe15af
commit
cf5b72bc00
|
@ -154,7 +154,7 @@ public final class POIFSDocument implements POIFSViewable, Iterable<ByteBuffer>
|
|||
}
|
||||
}
|
||||
|
||||
return (int)length;
|
||||
return Math.toIntExact(length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -455,7 +455,7 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
Collections.sort(allValues);
|
||||
}
|
||||
|
||||
int limit = (int) conf.getRank();
|
||||
int limit = Math.toIntExact(conf.getRank());
|
||||
if (conf.getPercent()) {
|
||||
limit = allValues.size() * limit / 100;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue