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
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@539453 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5d9a2d947a
commit
80249d9780
@ -22,6 +22,7 @@ package org.apache.poi.hslf;
|
|||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
|
import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
|
||||||
import org.apache.poi.hslf.record.CurrentUserAtom;
|
import org.apache.poi.hslf.record.CurrentUserAtom;
|
||||||
import org.apache.poi.hslf.record.DocumentEncryptionAtom;
|
import org.apache.poi.hslf.record.DocumentEncryptionAtom;
|
||||||
import org.apache.poi.hslf.record.PersistPtrHolder;
|
import org.apache.poi.hslf.record.PersistPtrHolder;
|
||||||
@ -84,6 +85,11 @@ public class EncryptedSlideShow
|
|||||||
|
|
||||||
CurrentUserAtom cua = hss.getCurrentUserAtom();
|
CurrentUserAtom cua = hss.getCurrentUserAtom();
|
||||||
if(cua.getCurrentEditOffset() != 0) {
|
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
|
// Grab the details of the UserEditAtom there
|
||||||
Record r = Record.buildRecordAtOffset(
|
Record r = Record.buildRecordAtOffset(
|
||||||
hss.getUnderlyingBytes(),
|
hss.getUnderlyingBytes(),
|
||||||
|
Loading…
Reference in New Issue
Block a user