瀏覽代碼

some more checks for int overflows

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1857609 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_4_1_1
PJ Fanning 5 年之前
父節點
當前提交
cf5b72bc00

+ 1
- 1
src/java/org/apache/poi/poifs/filesystem/POIFSDocument.java 查看文件

@@ -154,7 +154,7 @@ public final class POIFSDocument implements POIFSViewable, Iterable<ByteBuffer>
}
}

return (int)length;
return Math.toIntExact(length);
}
/**

+ 2
- 1
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));
}

/**

+ 1
- 1
src/java/org/apache/poi/ss/formula/EvaluationConditionalFormatRule.java 查看文件

@@ -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…
取消
儲存