Bug 66425: Avoid exceptions found via poi-fuzz

Prevent NullPointerException

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64943

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1915004 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2023-12-30 19:39:31 +00:00
parent 4d175324f2
commit 94ace1c4b0
5 changed files with 8 additions and 2 deletions

View File

@ -745,6 +745,10 @@ public abstract class AbstractWordConverter {
}
case FIELD_DROP_DOWN: {
Range fieldContent = field.firstSubrange(parentRange);
if (fieldContent == null) {
throw new IllegalStateException("Cannot read field content from field " + field + " and range " + parentRange);
}
CharacterRun cr = fieldContent.getCharacterRun(fieldContent
.numCharacterRuns() - 1);
String[] values = cr.getDropDownListValues();

View File

@ -61,7 +61,8 @@ public class TestWordToConverterSuite {
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-4947285593948160.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-5440721166139392.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-5050208641482752.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-4892412469968896.doc"
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-4892412469968896.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-6610789829836800.doc"
);
public static Stream<Arguments> files() {

View File

@ -54,7 +54,8 @@ public class TestWordToTextConverter {
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-4947285593948160.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-5440721166139392.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-5050208641482752.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-4892412469968896.doc"
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-4892412469968896.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-6610789829836800.doc"
);
/**

Binary file not shown.