mirror of https://github.com/apache/poi.git
Bug 66425: Avoid exceptions found via poi-fuzz
Prevent ClassCastException Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63504 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1914991 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
28811d26df
commit
8507fdf371
|
@ -57,7 +57,11 @@ public class HSSFShapeFactory {
|
||||||
}
|
}
|
||||||
EscherClientDataRecord clientData = ((EscherContainerRecord) child).getChildById(EscherClientDataRecord.RECORD_ID);
|
EscherClientDataRecord clientData = ((EscherContainerRecord) child).getChildById(EscherClientDataRecord.RECORD_ID);
|
||||||
if (null != clientData) {
|
if (null != clientData) {
|
||||||
obj = (ObjRecord) agg.getShapeToObjMapping().get(clientData);
|
Record record = agg.getShapeToObjMapping().get(clientData);
|
||||||
|
if (!(record instanceof ObjRecord)) {
|
||||||
|
throw new IllegalArgumentException("Had unexpected type of clientData: " + (record == null ? "<null>" : record.getClass()));
|
||||||
|
}
|
||||||
|
obj = (ObjRecord) record;
|
||||||
}
|
}
|
||||||
HSSFShapeGroup group = new HSSFShapeGroup(container, obj);
|
HSSFShapeGroup group = new HSSFShapeGroup(container, obj);
|
||||||
List<EscherContainerRecord> children = container.getChildContainers();
|
List<EscherContainerRecord> children = container.getChildContainers();
|
||||||
|
|
|
@ -57,6 +57,7 @@ class TestBiffDrawingToXml extends BaseTestIteratingXLS {
|
||||||
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5285517825277952.xls", IllegalArgumentException.class);
|
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5285517825277952.xls", IllegalArgumentException.class);
|
||||||
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5436547081830400.xls", IllegalArgumentException.class);
|
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5436547081830400.xls", IllegalArgumentException.class);
|
||||||
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5889658057523200.xls", IndexOutOfBoundsException.class);
|
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5889658057523200.xls", IndexOutOfBoundsException.class);
|
||||||
|
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-4977868385681408.xls", IllegalArgumentException.class);
|
||||||
return excludes;
|
return excludes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,9 @@ class TestDrawingAggregate {
|
||||||
File[] files = testData.listFiles((dir, name) -> name.endsWith(".xls"));
|
File[] files = testData.listFiles((dir, name) -> name.endsWith(".xls"));
|
||||||
assertNotNull(files, "Need to find files in test-data path, had path: " + testData);
|
assertNotNull(files, "Need to find files in test-data path, had path: " + testData);
|
||||||
return Stream.of(files).
|
return Stream.of(files).
|
||||||
filter(file -> !file.getName().equals("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5285517825277952.xls")).
|
filter(file ->
|
||||||
|
!file.getName().equals("clusterfuzz-testcase-minimized-POIHSSFFuzzer-5285517825277952.xls") &&
|
||||||
|
!file.getName().equals("clusterfuzz-testcase-minimized-POIHSSFFuzzer-4977868385681408.xls")).
|
||||||
map(Arguments::of);
|
map(Arguments::of);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue