]> source.dussan.org Git - poi.git/commitdiff
When trying to tell if a PPT file is encrypted or not, try to avoid an AIOOB
authorNick Burch <nick@apache.org>
Thu, 23 Aug 2007 12:03:20 +0000 (12:03 +0000)
committerNick Burch <nick@apache.org>
Thu, 23 Aug 2007 12:03:20 +0000 (12:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@568949 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java

index 2b92b848d248d2d5ea97c2eaf2dc7cabfb963246..15625fd2a85d321413d90713b4ad1a4d105ab909 100644 (file)
@@ -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;