From 80cda31844ae238012a2eacb0a9429ec4202438c Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Thu, 23 Aug 2007 12:03:20 +0000 Subject: [PATCH] When trying to tell if a PPT file is encrypted or not, try to avoid an AIOOB git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@568949 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hslf/EncryptedSlideShow.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java b/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java index 2b92b848d2..15625fd2a8 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java +++ b/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java @@ -91,10 +91,15 @@ public class EncryptedSlideShow } // Grab the details of the UserEditAtom there - Record r = Record.buildRecordAtOffset( - hss.getUnderlyingBytes(), - (int)cua.getCurrentEditOffset() - ); + // If the record's messed up, we could AIOOB + Record r = null; + try { + r = Record.buildRecordAtOffset( + hss.getUnderlyingBytes(), + (int)cua.getCurrentEditOffset() + ); + } catch(ArrayIndexOutOfBoundsException e) {} + if(r == null) { return null; } if(! (r instanceof UserEditAtom)) { return null; } UserEditAtom uea = (UserEditAtom)r; -- 2.39.5