292 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
e9e9612a1f Avoid ClassCastException when reading headers of EMF files 2026-02-21 15:39:54 +01:00
PJ Fanning
6ba4a1b050 Update TestDocumentEncryption.java 2026-02-20 14:52:28 +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
55c1608a2d Avoid NPE with malformed anchors in slideshow files 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
0ae15edb2c Perform an allocation-check for .emf files 2026-01-24 14:45:16 +01:00
Dominik Stadler
e54ba888e2 Log instead of an assertion
Issues which can be triggered by malformed documents
should not use "assert"
2026-01-18 18:27:05 +01:00
PJ Fanning
58ac8d05f0
throw exception if getAlpha returns very large value (that is too big for int) (#1000) 2026-01-17 15:09:06 +01:00
Jacobo Aragunde Pérez
372388b7ed
Support rendering transparent bitmaps in presentations. (#990)
* Support rendering transparent bitmaps in presentations.

Add PictureShape.getAlpha() method and implementations for HSLF and
XSLF. Then make use of it in DrawPictureShape to apply the right alpha
value to the picture being drawn.

Fixed a bug in BitmapImageRenderer that considered alpha value 0 as
"fully opaque", when it means "fully transparent" instead.

Finally, added a test for this feature in TestDrawPictureShape for XSLF.
A test for HSLF could not be created because it was not possible to
generate a test file with today's tools; MS Office removes the
bitmap transparency effect when saving as .ppt, and LibreOffice blends
it into the bitmap.

* Address reviewer comments.

* Add comment about default alpha value.

* Prevent NPE in XSLFPictureShape.getAlpha().

* Change wording in comments to avoid the word "percentage".

* Use static vars for extreme alpha values.
2026-01-17 13:47:09 +01:00
Dominik Stadler
22531fe638 Prevent invalid height/width in wmf-images exhausting memory
Introduce an adjustable limit of maximum number of pixels
for when drawing the image
2026-01-16 18:49:27 +01:00
Dominik Stadler
9c2f487c98 Bug 69927: Avoid NPE when parsing wmf-file
headerBitCount can be null if the header contains an
invalid flag
2026-01-16 18:49:27 +01:00
Dominik Stadler
1fc4f9e3b7 Avoid ClastCastException when handling a broken ppt file 2026-01-12 06:48:23 +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
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
9e1afbbab1 Fix some more Gradle deprecation-warnings in preparation for Gradle 9
Only signing-handling in poi-ooxml is still remaining, but
this deprecation seems to have been moved to Gradle 10 anyway.

Gradle 9 will require JDK 17, though, so we can only upgrade
when the min. supported JDK is bumped once more.
2025-12-19 16:15:21 +01:00
Dominik Stadler
fd66689944 Improve message if test fails 2025-12-17 22:12:41 +01:00
PJ Fanning
f44ece137f adjust 'since' values to remove POI 2025-12-01 19:28:56 +01:00
PJ Fanning
cb520e8046
remove deprecated getCodepoints method (#940) 2025-11-19 13:58:03 +01:00
PJ Fanning
ae0a17765e remove deprecated isStartAtOverriden 2025-11-19 13:44:59 +01:00
PJ Fanning
71b4b62a6d remove deprecated shortArrayToByteArray 2025-11-19 13:43:55 +01:00
Dominik Stadler
3116668737 Remove identical overriding method 2025-11-16 22:34:18 +01:00
Dominik Stadler
59e595b844 Remove some of the deprecated methods with @Removal("6.0.0")
We announced their removal for 6.0.0, so
we can remove them now as we plan a 6.0.0 release
next.

Some were not yet removed as they have still internal
usage or seem to need more work to finally remove.
2025-11-16 22:34:18 +01:00
Dominik Stadler
c6a621edc6 Remove deprecated methods with @Removal("5...")
We announced their removal already for 5.0.0 or 5.3.0, so
we can safely remove them now as we plan a 6.0.0 release
next.

Cell.setCellType() needs a closer look later as
it is not a simple deletion of code.
2025-11-16 22:34:18 +01:00
Dominik Stadler
cd22293975 Newer Mockito prevents using code from org.mockito.internal.matchers
At least locally tests fail now for me, so let's get rid of using
internal code here.
2025-11-16 14:18:06 +01:00
Dominik Stadler
d486e50822 Use OpenRewrite to update code to make use of Java 11 2025-11-16 14:18:06 +01:00
PJ Fanning
16ecbc7d48 build issues 2025-11-15 11:34:52 +01:00
PJ Fanning
323b5c8c6b start move to require java 11 min 2025-11-15 11:26:19 +01:00
Dominik Stadler
207d67c12b Prevent a NullPointerException
The regression-corpus contains some documents which trigger this,
but succeed with the added null-check
2025-11-03 07:26:03 +01:00
PJ Fanning
49fd564023
log4j bom (#897) 2025-09-11 10:52:01 +01:00
PJ Fanning
559485a0fe throw OfficeXmlFileException if hwpf reads an ooxml file 2025-09-05 11:04:29 +01:00
PJ Fanning
2fbfe2ea7e Create TestHSLFParser.java 2025-09-05 10:45:07 +01:00
PJ Fanning
9f9ff14e56 add test 2025-08-28 13:00:54 +01:00
PJ Fanning
061d6a3d0f more parsers 2025-08-20 18:34:48 +01:00
PJ Fanning
a6f65db642 remove import
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1926415 13f79535-47bb-0310-9956-ffa450edef68
2025-06-14 14:15:47 +00:00
PJ Fanning
c01228c331 [bug-69697] HSLF getPictureData can return null for some pictures
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1926414 13f79535-47bb-0310-9956-ffa450edef68
2025-06-14 14:14:15 +00:00
PJ Fanning
378a0bed06 [bug-69669] refactor
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1925874 13f79535-47bb-0310-9956-ffa450edef68
2025-05-27 20:15:50 +00:00
PJ Fanning
16b53a8bc7 [bug-69669] try to share some code between the old code that I brought back and the newer code that caused the problems
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1925872 13f79535-47bb-0310-9956-ffa450edef68
2025-05-27 18:48:31 +00:00
PJ Fanning
d189f69333 remove temp test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1925871 13f79535-47bb-0310-9956-ffa450edef68
2025-05-27 18:03:51 +00:00
PJ Fanning
35a6ae72be [bug-69669] revert some changes in HSLF placeholder creation due to issue with addTitle
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1925870 13f79535-47bb-0310-9956-ffa450edef68
2025-05-27 18:02:22 +00:00
PJ Fanning
67b0dc3966 try to avoid recreating HSLFShapePlaceholderDetails
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1925869 13f79535-47bb-0310-9956-ffa450edef68
2025-05-27 17:34:05 +00:00
PJ Fanning
c1dc0c6130 te
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1925864 13f79535-47bb-0310-9956-ffa450edef68
2025-05-27 11:56:43 +00:00
PJ Fanning
f298390ec3 code refactor
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1925649 13f79535-47bb-0310-9956-ffa450edef68
2025-05-17 16:46:23 +00:00
PJ Fanning
e867e371be typos (an)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1925440 13f79535-47bb-0310-9956-ffa450edef68
2025-05-06 20:12:35 +00:00