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
This commit is contained in:
Nick Burch 2007-08-23 12:03:20 +00:00
parent 1998bb30a5
commit ac3c57b0d8

View File

@ -91,10 +91,15 @@ public class EncryptedSlideShow
} }
// Grab the details of the UserEditAtom there // Grab the details of the UserEditAtom there
Record r = Record.buildRecordAtOffset( // If the record's messed up, we could AIOOB
hss.getUnderlyingBytes(), Record r = null;
(int)cua.getCurrentEditOffset() try {
); r = Record.buildRecordAtOffset(
hss.getUnderlyingBytes(),
(int)cua.getCurrentEditOffset()
);
} catch(ArrayIndexOutOfBoundsException e) {}
if(r == null) { return null; }
if(! (r instanceof UserEditAtom)) { return null; } if(! (r instanceof UserEditAtom)) { return null; }
UserEditAtom uea = (UserEditAtom)r; UserEditAtom uea = (UserEditAtom)r;