Commit Graph

13105 Commits

Author SHA1 Message Date
Dominik Stadler 0dea4a301c Bug 66425: Avoid exceptions found via poi-fuzz
Processing formats uses regular expressions. Very complex formats
can recurse very deeply and thus can cause StackOVerflows depending
on the used stack-size.

In order to handle this a bit more gracefully, we now catch this
and report a better exception with details about the parsed 
format and potential mitigation.

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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919342 13f79535-47bb-0310-9956-ffa450edef68
2024-07-18 07:09:32 +00:00
PJ Fanning 0dac5680c3 commons-codec 1.17.1 - no need to note Saxon upgrade (only used in tests)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919288 13f79535-47bb-0310-9956-ffa450edef68
2024-07-16 14:11:35 +00:00
Dominik Stadler 7b15aefae8 Bug 66425: Avoid exceptions found via poi-fuzz
Avoid a possible OutOfMemoryException with incorrect uniqueCount

The ReadOnlySharedStringsTable pre-allocates whatever is stated in uniqueCount.

As the uniqueCount may be an incorrect large number, we should cap it at some point
to avoid OOMs if corrupt files are processed.

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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919284 13f79535-47bb-0310-9956-ffa450edef68
2024-07-16 13:26:16 +00:00
PJ Fanning cc4fbe1c4d POI tm
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919276 13f79535-47bb-0310-9956-ffa450edef68
2024-07-16 12:33:05 +00:00
PJ Fanning 264a215573 gradle 8.9
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919274 13f79535-47bb-0310-9956-ffa450edef68
2024-07-16 07:42:28 +00:00
Dominik Stadler 09fbfd5be4 Bug 66425: Avoid exceptions found via poi-fuzz
Avoid a possible OutOfMemoryException with many child-records

This avoids having too many children in EscherRecords, the limit of
100_000 is arbitrarily chosen and can be adjusted if needed  

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62924 and maybe others

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919272 13f79535-47bb-0310-9956-ffa450edef68
2024-07-16 05:26:42 +00:00
PJ Fanning 9456261cba update bytebuddy
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919268 13f79535-47bb-0310-9956-ffa450edef68
2024-07-15 22:42:38 +00:00
PJ Fanning ebb9cde924 update gradle plugins
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919266 13f79535-47bb-0310-9956-ffa450edef68
2024-07-15 22:41:18 +00:00
Dominik Stadler e75d2c6d9f Remove exclusions that are not necessary/useful
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919258 13f79535-47bb-0310-9956-ffa450edef68
2024-07-15 13:04:48 +00:00
Dominik Stadler a3d9c025e9 Apply some IDE suggestions
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919257 13f79535-47bb-0310-9956-ffa450edef68
2024-07-15 13:03:19 +00:00
Dominik Stadler 2582e5e0c1 Bug 66425: Avoid exceptions found via poi-fuzz
Avoid a possible StackOverflowException

This adds support of counting of the "nesting level" into the base 
EscherRecord and thus makes this existing limitation much more effective
as it kicks in for more types of nested records. 

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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919256 13f79535-47bb-0310-9956-ffa450edef68
2024-07-15 13:02:43 +00:00
Dominik Stadler 719e7154a1 Optimize generating numbers for bullets in Word
Using char[] instead of String improves performance of this
operation considerably, especially in JDK 11+ where StringBuilder
was switched to work on bytes instead of chars.

This is likely only relevant for very large documents, it was visible
in a synthetic test-file from fuzzing.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919239 13f79535-47bb-0310-9956-ffa450edef68
2024-07-15 05:41:14 +00:00
Dominik Stadler a971751238 Reformat and add more tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919238 13f79535-47bb-0310-9956-ffa450edef68
2024-07-15 05:41:10 +00:00
Dominik Stadler e2044c958b Bug 66425: Avoid exceptions found via poi-fuzz
Prevent too much memory usage

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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919237 13f79535-47bb-0310-9956-ffa450edef68
2024-07-15 05:41:04 +00:00
Dominik Stadler 5085e3d1b2 Add initial support for SOURCE_DATE_EPOCH
This allows to create reproducible binary files without creation/modification-timestamp
being set when environment variable SOURCE_DATE_EPOCH is set.

See https://reproducible-builds.org/docs/source-date-epoch/ for the related specification.

For now, we ensure that Zip-file entries set the modification time to 1970-01-01,
which seems to be enough to make simple OOXML files reproducible.

There are likely some other places where resulting files are not reproducible, some
more testing will be necessary to identify other areas that should take this into
account as well.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919236 13f79535-47bb-0310-9956-ffa450edef68
2024-07-15 05:40:56 +00:00
Dominik Stadler 1a07ee8d6a Patch forrest to expect all links to be "https" instead of "http"
Otherwise generating documentation leads to incorrect links with "../https://..."

Unfortunately Forrest is archived at Apache so we cannot get this fixed
in Forrest anymore.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919235 13f79535-47bb-0310-9956-ffa450edef68
2024-07-15 05:40:48 +00:00
Dominik Stadler 04a956ab8f Adjust the name of the distribution-file in one more place.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919221 13f79535-47bb-0310-9956-ffa450edef68
2024-07-14 13:11:23 +00:00
Dominik Stadler 8be69305ca Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a NullPointerException

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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919216 13f79535-47bb-0310-9956-ffa450edef68
2024-07-14 11:27:02 +00:00
Dominik Stadler a042165133 Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a NullPointerException

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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919215 13f79535-47bb-0310-9956-ffa450edef68
2024-07-14 11:26:56 +00:00
Dominik Stadler fc17f113d8 Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a ClassCastException

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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919214 13f79535-47bb-0310-9956-ffa450edef68
2024-07-14 11:26:50 +00:00
Dominik Stadler 7601beb592 Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a NullPointerException

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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919213 13f79535-47bb-0310-9956-ffa450edef68
2024-07-14 11:26:43 +00:00
Dominik Stadler 148ac23c0d List expected failures in stress.xls instead of fully excluding them
We list expected failures in stress.xls to verify that
the error message is correct and no unexpected exception
is introduced

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919212 13f79535-47bb-0310-9956-ffa450edef68
2024-07-14 11:26:38 +00:00
PJ Fanning a0008d6764 update exception message
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919091 13f79535-47bb-0310-9956-ffa450edef68
2024-07-10 11:39:27 +00:00
PJ Fanning 302b43641f add negative test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919065 13f79535-47bb-0310-9956-ffa450edef68
2024-07-09 14:43:03 +00:00
PJ Fanning bfd4645a72 add test case
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919064 13f79535-47bb-0310-9956-ffa450edef68
2024-07-09 14:16:47 +00:00
PJ Fanning c1d6d0d4a1 make validateEntryNames use case insensitive check
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919058 13f79535-47bb-0310-9956-ffa450edef68
2024-07-09 09:46:46 +00:00
Dominik Stadler 894ef6e1bd Fix Paragraph.searchText
The result was wrong for certain combinations of runs and found positions.

The adjusted implementation fixes this.

Also add a number of additional tests to verify results are correct.

Closes #655

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918986 13f79535-47bb-0310-9956-ffa450edef68
2024-07-07 06:40:36 +00:00
Dominik Stadler 397cee3a12 Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a NullPointerException

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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918985 13f79535-47bb-0310-9956-ffa450edef68
2024-07-07 06:40:31 +00:00
Dominik Stadler 164c239a52 HSSFWorkbook.getSheet(): Return first found sheet
We do not need to loop over all sheets always but should
be able to return the first found sheet.

This may change semantics for cases where there are
multiple sheets where name only differs in case, but
the JavaDoc did not state which one will be returned.

All three implementations (HSSF, XSSF, SXSSF)
now behave the same way.

Closes #653

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918982 13f79535-47bb-0310-9956-ffa450edef68
2024-07-07 05:03:15 +00:00
PJ Fanning d090c6b77a update TestXSSFSheetShiftRows
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918978 13f79535-47bb-0310-9956-ffa450edef68
2024-07-06 20:17:22 +00:00
PJ Fanning 750657064a saxon 12.5
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918857 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 20:29:26 +00:00
PJ Fanning e1c6168682 [bug-69154] add speculative row shifter fix
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918841 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 13:10:29 +00:00
PJ Fanning 3d1375deee [bug-69154] XSSF: Shifting columns with merged regions generates an error about overlapping regions
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918838 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 12:58:37 +00:00
PJ Fanning a78d594b73 unused import
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918833 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 12:44:23 +00:00
PJ Fanning 559de96cc0 snapshot version
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918832 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 12:37:38 +00:00
PJ Fanning 6e07ce50dd add dataformatter test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918819 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 09:42:02 +00:00
PJ Fanning 04c9d0a3c1 another dataformatter test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918817 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 09:08:40 +00:00
PJ Fanning 05c79326be another dataformatter test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918810 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 00:32:59 +00:00
PJ Fanning 3f246cc189 disable new dataformatter test that is failing
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918809 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 00:22:49 +00:00
PJ Fanning a12c95990b try to fix tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918808 13f79535-47bb-0310-9956-ffa450edef68
2024-07-02 00:02:47 +00:00
PJ Fanning 648a2e58b0 add dataformatter tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918807 13f79535-47bb-0310-9956-ffa450edef68
2024-07-01 23:45:40 +00:00
PJ Fanning 96fa957ef5 try to stop poi-integration testing with corrupt file
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918806 13f79535-47bb-0310-9956-ffa450edef68
2024-07-01 23:27:27 +00:00
PJ Fanning 66f89c50d6 try to stop poi-integration testing with corrupt file
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918805 13f79535-47bb-0310-9956-ffa450edef68
2024-07-01 23:19:33 +00:00
PJ Fanning 7e86ff1bb0 use standard ASF header
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918804 13f79535-47bb-0310-9956-ffa450edef68
2024-07-01 23:06:36 +00:00
PJ Fanning 8a37350e94 rename file
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918803 13f79535-47bb-0310-9956-ffa450edef68
2024-07-01 22:50:04 +00:00
PJ Fanning 03b0742ad3 throw exception if xlsx contains duplicate file names
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918802 13f79535-47bb-0310-9956-ffa450edef68
2024-07-01 22:40:18 +00:00
PJ Fanning 600bf8c4b3 license header
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918801 13f79535-47bb-0310-9956-ffa450edef68
2024-07-01 21:37:53 +00:00
PJ Fanning f8a990051b throw exception if xlsx contains duplicate file names
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918800 13f79535-47bb-0310-9956-ffa450edef68
2024-07-01 21:36:31 +00:00
PJ Fanning d879a94a15 reformat ZipFileZipEntrySource.java
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918799 13f79535-47bb-0310-9956-ffa450edef68
2024-07-01 21:30:07 +00:00
PJ Fanning 527f26aac9 junit 5.10.3
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1918712 13f79535-47bb-0310-9956-ffa450edef68
2024-06-27 15:12:15 +00:00