From 8f1c84c3faaf31f158fb0b5331840d7ea46dda97 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sat, 22 Jan 2022 06:58:39 +0000 Subject: [PATCH] Avoid stackoverflow exception that can be caused by a corrupted slideshow file git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897318 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/poi/ddf/AbstractEscherOptRecord.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/poi/src/main/java/org/apache/poi/ddf/AbstractEscherOptRecord.java b/poi/src/main/java/org/apache/poi/ddf/AbstractEscherOptRecord.java index 1fdf63380e..536e590a2d 100644 --- a/poi/src/main/java/org/apache/poi/ddf/AbstractEscherOptRecord.java +++ b/poi/src/main/java/org/apache/poi/ddf/AbstractEscherOptRecord.java @@ -55,6 +55,9 @@ public abstract class AbstractEscherOptRecord extends EscherRecord { EscherRecordFactory recordFactory ) { int bytesRemaining = readHeader( data, offset ); + if (bytesRemaining < 0) { + throw new IllegalStateException("Invalid value for bytesRemaining: " + bytesRemaining); + } short propertiesCount = readInstance( data, offset ); int pos = offset + 8; -- 2.39.5