660 Commits

Author SHA1 Message Date
Dominik Stadler
44598bd030 Avoid OOM with incorrect property sizes
Add allocation check to verify size >= 0 and < 1mio
Also reformat code to match general coding style

Fixes https://issues.oss-fuzz.com/issues/485091380
2026-02-21 15:39:55 +01:00
Dominik Stadler
23369586da Avoid assertion when handling slightly corrupted emf-file
Also remove methods which are identical to the ones in the super-class

Fixes https://issues.oss-fuzz.com/issues/486039135
2026-02-21 15:39:54 +01:00
Dominik Stadler
9d9865c9b8 Avoid NPE when handling diagrams in pptx
Fixes https://issues.oss-fuzz.com/issues/484589690
2026-02-21 15:39:54 +01:00
Dominik Stadler
e9e9612a1f Avoid ClassCastException when reading headers of EMF files 2026-02-21 15:39:54 +01:00
Dominik Stadler
839ce4a0f4 Avoid NPE in HSSFShapeGroup.setShapeId() 2026-02-21 15:39:54 +01:00
Dominik Stadler
260b22fb09 Handle slightly broken file with empty BlipFill properly 2026-02-21 15:39:54 +01:00
Dominik Stadler
bc02ef0703 Avoid NPE with malformed wmf headers 2026-02-14 21:26:00 +01:00
Dominik Stadler
692caf0f36 Avoid NPE with malformed master-style 2026-02-14 21:26:00 +01:00
Dominik Stadler
e96c9e17c0 Avoid NPE with malformed EscherAggregate 2026-02-14 21:26:00 +01:00
Dominik Stadler
55c1608a2d Avoid NPE with malformed anchors in slideshow files 2026-02-14 21:26:00 +01:00
Dominik Stadler
5338b17a8f Avoid NPE with malformed Visio diagram
Fixes https://issues.oss-fuzz.com/issues/477312394
2026-02-14 21:26:00 +01:00
Dominik Stadler
c92c533d7a Prevent large allocations when writing PPDrawing items
Add an allocation check which can be disabled if necessary.

Fixes https://issues.oss-fuzz.com/issues/477289649 and https://issues.oss-fuzz.com/issues/479564936
2026-02-14 21:26:00 +01:00
Dominik Stadler
ab196a7441 Use log instead of assert when parsing emf-files
Assert effectively hides problem in provided input files.
2026-01-24 14:47:30 +01:00
Dominik Stadler
da3d64d9e3 Add an NPE check when retrieving fonts for bullet-items 2026-01-24 14:47:30 +01:00
Dominik Stadler
d1f3f9489f Add check for too large allocation in SharedFormulaGroup
A malformed spreadsheet could trigger a very large allocation.

Can be overruled by users via IOUtils.setByteArrayMaxOverride().

Fixes https://issues.oss-fuzz.com/issues/476431391
2026-01-18 18:28:36 +01:00
Dominik Stadler
d1f0a88ea1 Avoid NPE in XSLFDiagram
Throw IllegalStateException instead

Fixes https://issues.oss-fuzz.com/issues/476184825
2026-01-18 18:28:36 +01:00
Dominik Stadler
66109187d1 Only allocate the required size for EscherComplexProperty
Otherwise a malformed document can cause OOM by reserving
large chunks of memory, but only using little of it.

This fixes https://issues.oss-fuzz.com/issues/476184826
2026-01-18 18:28:36 +01:00
Dominik Stadler
d72e3a608c Add a file-handler for .emf files
These can be embedded in slideshows and POI supports
some handling of them.

Also Tika uses this code to extract some textual information
from such images.
2026-01-16 18:49:27 +01:00
Dominik Stadler
1910fff53e Add a file-handler for .wmf files
These can be embedded in slideshows and POI supports
some handling of them.

Also Tika uses this code to extract some textual information
from such images.
2026-01-16 18:49:27 +01:00
Dominik Stadler
2acb5cf66a Avoid several NPEs
When retrieving picture data
When retrieving text in slides
When handling XSLFTableStyles
In EmbeddedExtractor if ShapeName is not set
In HSSF with invalid EscherSpRecord
In HSSF with invalid RecordStreams
When drawing arcs for shapes in slides
In HSSFPicture.getPictureIndex
Adjust "opens" for tests in poi-ooxml

Either handle it gracefully or throw
IllegalStateException instead for broken files
2026-01-16 18:49:27 +01:00
Dominik Stadler
a5f5f4294e Avoid NPE when reading a broken xlsb file
Throw a more useful exception instead
2026-01-12 06:48:23 +01:00
Dominik Stadler
f8a8189230 Use the proper add-method to perform the check for max number of children
If adding is done without check it can trigger OOM when fuzzing.

This should fix https://issues.oss-fuzz.com/issues/391709145
2026-01-10 13:14:34 +01:00
Dominik Stadler
95b2a1cf1d Avoid NPE with broken files when reading xls file 2026-01-10 13:14:34 +01:00
Dominik Stadler
017ff5f8f8 Implement lazy allocation of data for complex escher properties
This may reduce memory usage if the content is never used
or not populated for some reason.

This should fix https://issues.oss-fuzz.com/issues/42528528
2026-01-10 13:14:34 +01:00
Dominik Stadler
c94e795f35 Avoid NPE with broken files when writing endnotes for Word documents
https://issues.oss-fuzz.com/issues/391728757
2026-01-09 08:45:03 +01:00
Dominik Stadler
e9b33c0b08 Avoid NPE with broken files when writing endnotes for Word documents
Fixes https://issues.oss-fuzz.com/issues/392690733
2026-01-09 08:45:03 +01:00
Dominik Stadler
befc941dcf Avoid NPE with broken files when handling paint-style for fill 2026-01-09 08:45:03 +01:00
Dominik Stadler
ac989335d7 Avoid NPE with broken files when handling text-shapes 2026-01-09 08:45:03 +01:00
Dominik Stadler
0ec4434f59 Avoid NPE with broken file 2026-01-09 08:45:03 +01:00
Dominik Stadler
ddf71d0984 Avoid two NPEs which were currently "expected" in tests
When things go wrong, we always want to give an
explanation via an exception instead of an NPE.
2026-01-06 22:47:00 +01:00
Dominik Stadler
338882ac88 Convert some files to unix newlines
Otherwise these can cause issues when checking out
sources on Windows
2025-12-17 22:11:29 +01:00
Dominik Stadler
25a2dd9227 Adjust parsing XSSFBuiltinTableStyle
In case of invalid enum-value keep the fallback-handling
as before as otherwise some existing documents fail to parse
2025-11-03 07:26:03 +01:00
Dominik Stadler
ea74954fcf Trigger reading metadata-text as part of integration testing
One test-case fails differently now
2025-10-06 07:40:53 +02:00
Dominik Stadler
42193c57e4 Try to verify handling of deeply nested xlsx 2025-10-06 07:40:53 +02:00
PJ Fanning
d0e6830e44
issue when formatting number when divisor is needed (#895)
* reproduce issue 69812

* workaround for issue
2025-09-09 22:27:48 +01:00
PJ Fanning
00c2a85c30 Update HeaderFooterComplexFormats.xlsx 2025-08-28 15:14:57 +01:00
PJ Fanning
9f9ff14e56 add test 2025-08-28 13:00:54 +01:00
PJ Fanning
9d37011683
workaround stray whitespace in sst index (#874)
* tolerate whitespace in ints

* try to workaround stray whitespace in sst index

* Update TestAllFiles.java
2025-08-05 12:00:54 +01:00
Dominik Stadler
80fd35198d Bug 66425: Avoid exceptions found via poi-fuzz
Prevent too deep nesting by throwing an exception
instead of just not parsing more nesting-levels as
this still caused OOMs.

Allow to adjust the limit via static setter as elsewhere
to give users a chance to parse very complicated files
if really necessary.

https://issues.oss-fuzz.com/issues/42528505

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923277 13f79535-47bb-0310-9956-ffa450edef68
2025-01-20 18:40:32 +00:00
Dominik Stadler
dd647b5d2d Bug 66425: Avoid exceptions found via poi-fuzz
Prevent NullPointerException

Fixes https://issues.oss-fuzz.com/issues/389724915

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923276 13f79535-47bb-0310-9956-ffa450edef68
2025-01-20 18:40:27 +00:00
Dominik Stadler
6befe2ad52 Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a NullPointerException

Fixes https://issues.oss-fuzz.com/issues/42537720

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923061 13f79535-47bb-0310-9956-ffa450edef68
2025-01-11 09:24:20 +00:00
Dominik Stadler
76617e9793 Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a NullPointerException

Fixes https://issues.oss-fuzz.com/issues/42537550

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923060 13f79535-47bb-0310-9956-ffa450edef68
2025-01-11 09:24:14 +00:00
Dominik Stadler
57afb34a18 Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a NullPointerException

Fixes https://issues.oss-fuzz.com/issues/379574870

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923059 13f79535-47bb-0310-9956-ffa450edef68
2025-01-11 09:24:08 +00:00
Dominik Stadler
edcbd87360 Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a NullPointerException

Fixes https://issues.oss-fuzz.com/issues/42538163

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923058 13f79535-47bb-0310-9956-ffa450edef68
2025-01-11 09:24:03 +00:00
Dominik Stadler
c1f52674fd Bug 69315: HSMF: At least continue processing properties after multivalued properties
Currently processing stops at multivalued properties.

This at least continues processing, so other properties are processed properly.

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1923051 13f79535-47bb-0310-9956-ffa450edef68
2025-01-11 09:23:29 +00:00
PJ Fanning
edb9aeaca5 [github-733] Fix rate order in Mirr function. Thanks to Aleksandrs Jansons. This closes #733
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1922095 13f79535-47bb-0310-9956-ffa450edef68
2024-11-25 20:48:45 +00:00
PJ Fanning
a139a17909 [github-692] D* functions are incompatible with the diamond operator. Thanks to Luk Spiewak. This closes #692
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1920817 13f79535-47bb-0310-9956-ffa450edef68
2024-09-20 20:20:34 +00:00
Dominik Stadler
0559accac4 Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a possible NullPointerException

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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919562 13f79535-47bb-0310-9956-ffa450edef68
2024-07-28 11:02:18 +00:00
PJ Fanning
c05eebf415 add chinese hssf test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919373 13f79535-47bb-0310-9956-ffa450edef68
2024-07-19 14:19:35 +00:00
PJ Fanning
889ba37ae9 remove 22742.xls
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919372 13f79535-47bb-0310-9956-ffa450edef68
2024-07-19 13:36:06 +00:00