Author: centic Date: Wed Dec 6 19:49:45 2023 New Revision: 1914403 URL: http://svn.apache.org/viewvc?rev=1914403&view=rev Log: Bug 66425: Avoid exceptions found via poi-fuzz
Change an assertion which can be triggered via an input-document. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63309 Added: poi/trunk/test-data/document/clusterfuzz-testcase-minimized-POIHWPFFuzzer-4892412469968896.doc Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PICFAndOfficeArtData.java poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToTextConverter.java poi/trunk/test-data/spreadsheet/stress.xls Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PICFAndOfficeArtData.java URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PICFAndOfficeArtData.java?rev=1914403&r1=1914402&r2=1914403&view=diff ============================================================================== --- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PICFAndOfficeArtData.java (original) +++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/PICFAndOfficeArtData.java Wed Dec 6 19:49:45 2023 @@ -88,7 +88,9 @@ public class PICFAndOfficeArtData { // [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()); + } } } Modified: poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java?rev=1914403&r1=1914402&r2=1914403&view=diff ============================================================================== --- poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java (original) +++ poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToConverterSuite.java Wed Dec 6 19:49:45 2023 @@ -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() { Modified: poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToTextConverter.java URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToTextConverter.java?rev=1914403&r1=1914402&r2=1914403&view=diff ============================================================================== --- poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToTextConverter.java (original) +++ poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/converter/TestWordToTextConverter.java Wed Dec 6 19:49:45 2023 @@ -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" ); /** Added: poi/trunk/test-data/document/clusterfuzz-testcase-minimized-POIHWPFFuzzer-4892412469968896.doc URL: http://svn.apache.org/viewvc/poi/trunk/test-data/document/clusterfuzz-testcase-minimized-POIHWPFFuzzer-4892412469968896.doc?rev=1914403&view=auto ============================================================================== Binary files poi/trunk/test-data/document/clusterfuzz-testcase-minimized-POIHWPFFuzzer-4892412469968896.doc (added) and poi/trunk/test-data/document/clusterfuzz-testcase-minimized-POIHWPFFuzzer-4892412469968896.doc Wed Dec 6 19:49:45 2023 differ Modified: poi/trunk/test-data/spreadsheet/stress.xls URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/stress.xls?rev=1914403&r1=1914402&r2=1914403&view=diff ============================================================================== Binary files - no diff available. --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org