From: Dominik Stadler Date: Sat, 22 Jan 2022 06:58:39 +0000 (+0000) Subject: Avoid stackoverflow exception that can be caused by a corrupted slideshow file X-Git-Tag: REL_5_2_1~179 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8f1c84c3faaf31f158fb0b5331840d7ea46dda97;p=poi.git 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 --- 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;