You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by ni...@apache.org on 2007/05/18 15:17:42 UTC

svn commit: r539453 - /jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java

Author: nick
Date: Fri May 18 06:17:41 2007
New Revision: 539453

URL: http://svn.apache.org/viewvc?view=rev&rev=539453
Log:
If the apparent location of the current user atom is past the end of the data, then the file's clearly corrupt, so throw a better exception

Modified:
    jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java

Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java?view=diff&rev=539453&r1=539452&r2=539453
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/EncryptedSlideShow.java Fri May 18 06:17:41 2007
@@ -22,6 +22,7 @@
 
 import java.io.FileNotFoundException;
 
+import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
 import org.apache.poi.hslf.record.CurrentUserAtom;
 import org.apache.poi.hslf.record.DocumentEncryptionAtom;
 import org.apache.poi.hslf.record.PersistPtrHolder;
@@ -84,6 +85,11 @@
 		
 		CurrentUserAtom cua = hss.getCurrentUserAtom();
 		if(cua.getCurrentEditOffset() != 0) {
+			// Check it's not past the end of the file
+			if(cua.getCurrentEditOffset() > hss.getUnderlyingBytes().length) {
+				throw new CorruptPowerPointFileException("The CurrentUserAtom claims that the offset of last edit details are past the end of the file");
+			}
+			
 			// Grab the details of the UserEditAtom there
 			Record r = Record.buildRecordAtOffset(
 					hss.getUnderlyingBytes(),



---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/