diff options
author | Dominik Stadler <centic@apache.org> | 2023-12-06 19:49:34 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2023-12-06 19:49:34 +0000 |
commit | 9fda604fb83a781ae581db06133583ae50394f3c (patch) | |
tree | e083ad8b8133340a98b3127e18b840303cb89718 /poi-examples | |
parent | e0b7dcda83288307c1ad7b656f0215d990c6ed05 (diff) | |
download | poi-9fda604fb83a781ae581db06133583ae50394f3c.tar.gz poi-9fda604fb83a781ae581db06133583ae50394f3c.zip |
Bug 66425: Avoid exceptions found via poi-fuzz
Capture and report integer overflow as normal
parsing/format exceptions
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63628
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1914401 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-examples')
-rw-r--r-- | poi-examples/src/main/java/org/apache/poi/examples/xssf/eventusermodel/XLSX2CSV.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/poi-examples/src/main/java/org/apache/poi/examples/xssf/eventusermodel/XLSX2CSV.java b/poi-examples/src/main/java/org/apache/poi/examples/xssf/eventusermodel/XLSX2CSV.java index fdbcc89901..d9fffabe48 100644 --- a/poi-examples/src/main/java/org/apache/poi/examples/xssf/eventusermodel/XLSX2CSV.java +++ b/poi-examples/src/main/java/org/apache/poi/examples/xssf/eventusermodel/XLSX2CSV.java @@ -212,7 +212,7 @@ public class XLSX2CSV { styles, null, strings, sheetHandler, formatter, false); sheetParser.setContentHandler(handler); sheetParser.parse(sheetSource); - } catch(ParserConfigurationException e) { + } catch (ParserConfigurationException e) { throw new RuntimeException("SAX parser appears to be broken - " + e.getMessage()); } } @@ -234,7 +234,12 @@ public class XLSX2CSV { String sheetName = iter.getSheetName(); this.output.println(); this.output.println(sheetName + " [index=" + index + "]:"); - processSheet(styles, strings, new SheetToCSV(), stream); + + try { + processSheet(styles, strings, new SheetToCSV(), stream); + } catch (NumberFormatException e) { + throw new IOException("Failed to parse sheet " + sheetName, e); + } } ++index; } |