protected void createNewDataSource() {
// Data needs to initially hold just the header block,
// a single bat block, and an empty properties section
- _data = new ByteArrayBackedDataSource(IOUtils.safelyAllocate(
- bigBlockSize.getBigBlockSize() * 3, MAX_RECORD_LENGTH));
+ long blockSize = ArithmeticUtils.mulAndCheck((long)bigBlockSize.getBigBlockSize(), (long)3);
+ _data = new ByteArrayBackedDataSource(IOUtils.safelyAllocate(blockSize, MAX_RECORD_LENGTH));
}
/**
package org.apache.poi.ss.util.cellwalk;
+import org.apache.commons.math3.util.ArithmeticUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
continue;
}
- ctx.ordinalNumber =
- (ctx.rowNumber - firstRow) * width +
- (ctx.colNumber - firstColumn + 1);
+ long rowSize = ArithmeticUtils.mulAndCheck(
+ (long)ArithmeticUtils.subAndCheck(ctx.rowNumber, firstRow), (long)width);
+
+ ctx.ordinalNumber = ArithmeticUtils.addAndCheck(rowSize, (ctx.colNumber - firstColumn + 1));
handler.onCell(currentCell, ctx);
}
import java.util.Collections;
import java.util.List;
+import org.apache.commons.math3.util.ArithmeticUtils;
import org.apache.poi.hslf.model.textproperties.IndentProp;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LittleEndian;
*/
private void write() {
int pos = 0;
- _data = IOUtils.safelyAllocate(indents.size()*6, MAX_RECORD_LENGTH);
+ long newSize = ArithmeticUtils.mulAndCheck((long)indents.size(), (long)6);
+ _data = IOUtils.safelyAllocate(newSize, MAX_RECORD_LENGTH);
for (IndentProp prop : indents) {
LittleEndian.putInt(_data, pos, prop.getCharactersCovered());
LittleEndian.putShort(_data, pos+4, (short)prop.getIndentLevel());