poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r477162 - /jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CurrentUserAtom.java
Date Mon, 20 Nov 2006 12:26:52 GMT
Author: nick
Date: Mon Nov 20 04:26:51 2006
New Revision: 477162

URL: http://svn.apache.org/viewvc?view=rev&rev=477162
Log:
Detect when the Current User stream is too short, and give a more helpful exception in that
case

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

Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CurrentUserAtom.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CurrentUserAtom.java?view=diff&rev=477162&r1=477161&r2=477162
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CurrentUserAtom.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/CurrentUserAtom.java Mon
Nov 20 04:26:51 2006
@@ -23,6 +23,7 @@
 import org.apache.poi.poifs.filesystem.*;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.util.StringUtil;
+import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
 
 
 /**
@@ -95,6 +96,12 @@
 		DocumentEntry docProps =
 			(DocumentEntry)fs.getRoot().getEntry("Current User");
 		_contents = new byte[docProps.getSize()];
+
+		// Check it's big enough - if it's not at least 28 bytes long, then
+		//  the record is corrupt
+		if(_contents.length < 28) {
+			throw new CorruptPowerPointFileException("The Current User stream must be at least 28
bytes long, but was only " + _contents.length);
+		}
 
 		// Grab the contents
 		InputStream in = fs.createDocumentInputStream("Current User");



---------------------------------------------------------------------
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/


Mime
View raw message