This is an automated email from the ASF dual-hosted git repository.

centic9 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git

commit 91865572cbeff16d55860f0d1ef1c68129fd9449
Author: Dominik Stadler <[email protected]>
AuthorDate: Sun Oct 25 11:32:27 2026 +0100

    Prevent OOM on overly large image dimensions in slideshows
    
    Let's limit image sizes for rendering slides by default to 4K
    to avoid OOM on extreme values in broken files.
    
    Fixes https://issues.oss-fuzz.com/issues/490920727
---
 .../java/org/apache/poi/stress/SlideShowHandler.java    |   5 +++++
 test-data/poi-integration-exceptions.csv                |   1 +
 ...-minimized-POIFileHandlerFuzzer-5802475696488448.ppt | Bin 0 -> 63119 bytes
 3 files changed, 6 insertions(+)

diff --git 
a/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java 
b/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java
index 9166094540..1e16471294 100644
--- a/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java
+++ b/poi-integration/src/test/java/org/apache/poi/stress/SlideShowHandler.java
@@ -40,6 +40,7 @@ import org.apache.poi.sl.usermodel.SlideShowFactory;
 import org.apache.poi.sl.usermodel.TextParagraph;
 import org.apache.poi.sl.usermodel.TextRun;
 import org.apache.poi.sl.usermodel.TextShape;
+import org.apache.poi.util.IOUtils;
 import org.junit.platform.commons.util.ExceptionUtils;
 
 public abstract class SlideShowHandler extends POIFSFileHandler {
@@ -129,6 +130,10 @@ public abstract class SlideShowHandler extends 
POIFSFileHandler {
         Dimension pgSize = ss.getPageSize();
 
         for (Slide<?,?> s : ss.getSlides()) {
+            // by default allow up to 4K UHD: 3840 × 2160
+            IOUtils.safelyAllocateCheck(pgSize.width, 3840);
+            IOUtils.safelyAllocateCheck(pgSize.height, 2160);
+
             BufferedImage img = new BufferedImage(pgSize.width, pgSize.height, 
BufferedImage.TYPE_INT_ARGB);
             Graphics2D graphics = img.createGraphics();
 
diff --git a/test-data/poi-integration-exceptions.csv 
b/test-data/poi-integration-exceptions.csv
index 85c383a630..f6d2ec5076 100644
--- a/test-data/poi-integration-exceptions.csv
+++ b/test-data/poi-integration-exceptions.csv
@@ -398,3 +398,4 @@ 
spreadsheet/LIBRE_OFFICE-116306-0.xlsx,extract,"XSSF,OPC",,org.apache.poi.util.R
 
spreadsheet/LIBRE_OFFICE-116306-0.xlsx,handle,XSSF,,org.apache.poi.util.RecordFormatException,Tried
 to allocate an array
 
spreadsheet/clusterfuzz-testcase-minimized-POIFileHandlerFuzzer-5318384433823744.emf,"handle,extract",HEMF,,org.apache.poi.util.RecordFormatException,Invalid
 value for undefinedSpace2
 
spreadsheet/clusterfuzz-testcase-minimized-FormulaParserFuzzer-6709334927802368.dat,handle,HMEF,,java.lang.IllegalArgumentException,TNEF
 signature not detected in file
+slideshow/clusterfuzz-testcase-minimized-POIFileHandlerFuzzer-5802475696488448.ppt,handle,HSLF,,org.apache.poi.util.RecordFormatException,Tried
 to allocate an array of length
\ No newline at end of file
diff --git 
a/test-data/slideshow/clusterfuzz-testcase-minimized-POIFileHandlerFuzzer-5802475696488448.ppt
 
b/test-data/slideshow/clusterfuzz-testcase-minimized-POIFileHandlerFuzzer-5802475696488448.ppt
new file mode 100644
index 0000000000..b955346e47
Binary files /dev/null and 
b/test-data/slideshow/clusterfuzz-testcase-minimized-POIFileHandlerFuzzer-5802475696488448.ppt
 differ


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to