Skip to content

Commit

Permalink
Bug 66425: Avoid exceptions found via poi-fuzz
Browse files Browse the repository at this point in the history
Change an assertion which can be triggered via an
input-document.

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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1914403 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
centic9 committed Dec 6, 2023
1 parent f1589b8 commit c7329fb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ public PICFAndOfficeArtData( byte[] dataStream, int startOffset )

// [MS-ODRAW] allows for multiple records in a OfficeArtInlineSpContainer, which is what we're parsing here.
// However, in the context of a HWPF document, there should be only 1.
assert _blipRecords.size() == 1;
if (_blipRecords.size() != 1) {
throw new IllegalStateException("Should only have one BLIP-Record, but had: " + _blipRecords.size());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public class TestWordToConverterSuite {
"TestHPSFWritingFunctionality.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-4947285593948160.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-5440721166139392.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-5050208641482752.doc"
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-5050208641482752.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-4892412469968896.doc"
);

public static Stream<Arguments> files() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public class TestWordToTextConverter {
"TestHPSFWritingFunctionality.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-4947285593948160.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-5440721166139392.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-5050208641482752.doc"
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-5050208641482752.doc",
"clusterfuzz-testcase-minimized-POIHWPFFuzzer-4892412469968896.doc"
);

/**
Expand Down
Binary file not shown.
Binary file modified test-data/spreadsheet/stress.xls
Binary file not shown.

0 comments on commit c7329fb

Please sign in to comment.