mirror of https://github.com/apache/poi.git
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
This commit is contained in:
parent
e0b7dcda83
commit
9fda604fb8
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ public class XSSFEventBasedExcelExtractor
|
|||
}
|
||||
|
||||
return text.toString();
|
||||
} catch (IOException | OpenXML4JException | SAXException e) {
|
||||
} catch (IOException | OpenXML4JException | SAXException | NumberFormatException e) {
|
||||
LOGGER.atWarn().withThrowable(e).log("Failed to load text");
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet, OoxmlSheetEx
|
|||
protected void onDocumentRead() {
|
||||
try (InputStream stream = getPackagePart().getInputStream()) {
|
||||
read(stream);
|
||||
} catch (IOException e){
|
||||
} catch (IOException | ArithmeticException e){
|
||||
throw new POIXMLException(e);
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue