diff options
author | PJ Fanning <fanningpj@apache.org> | 2023-01-28 20:44:26 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2023-01-28 20:44:26 +0000 |
commit | cde87ab3c61d68baea10e1d77c2331dd8631f2fa (patch) | |
tree | 44a3114b03e697aae739c11db8abc3b999c7cc7a | |
parent | 1cf4094e2d55330e882f26ccfd8cf12f370baa52 (diff) | |
download | poi-cde87ab3c61d68baea10e1d77c2331dd8631f2fa.tar.gz poi-cde87ab3c61d68baea10e1d77c2331dd8631f2fa.zip |
edge case (avoid short overflow)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1907066 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index dd99b1e5da..2613e80e64 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -1706,9 +1706,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx index = Math.toIntExact(col.getMax()); } worksheet.setColsArray(0, ctCols); - if (maxLevelCol > getSheetFormatPrOutlineLevelCol()) { - increaseSheetFormatPrOutlineLevelColIfNecessary((short) maxLevelCol); - } + increaseSheetFormatPrOutlineLevelColIfNecessary((short) Math.min(Short.MAX_VALUE, maxLevelCol)); } /** @@ -1743,9 +1741,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx maxOutlineLevel = Math.max(maxOutlineLevel, newOutlineLevel); ctrow.setOutlineLevel((short) newOutlineLevel); } - if (maxOutlineLevel >= 0) { - increaseSheetFormatPrOutlineLevelRowIfNecessary((short) maxOutlineLevel); - } + increaseSheetFormatPrOutlineLevelRowIfNecessary((short) Math.min(Short.MAX_VALUE, maxOutlineLevel)); } private short getMaxOutlineLevelRows(){ |