aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTim Allison <tallison@apache.org>2016-10-28 13:39:40 +0000
committerTim Allison <tallison@apache.org>2016-10-28 13:39:40 +0000
commit0ec3c4cd14213cbe91f0dbdc05ecfce45e9bfa9a (patch)
tree45ea6b7539b8c4d5e0b61f7ab3b40d4d21506f78 /src
parenta770463b350386c2edeca1f45ab3791299a704dd (diff)
downloadpoi-0ec3c4cd14213cbe91f0dbdc05ecfce45e9bfa9a.tar.gz
poi-0ec3c4cd14213cbe91f0dbdc05ecfce45e9bfa9a.zip
60305 -- gracefully handle truncated images while reading pictstream
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1767023 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
index 93fa92a457..493d461746 100644
--- a/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
+++ b/src/scratchpad/src/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
@@ -400,6 +400,14 @@ public final class HSLFSlideShowImpl extends POIDocument implements Closeable {
logger.log(POILogger.ERROR, "Problem reading picture: Invalid image type 0, on picture with length " + imgsize + ".\nYou document will probably become corrupted if you save it!");
logger.log(POILogger.ERROR, "" + pos);
} else {
+ //The pictstream can be truncated halfway through a picture.
+ //This is not a problem if the pictstream contains extra pictures
+ //that are not used in any slide -- BUG-60305
+ if (pos+imgsize > pictstream.length) {
+ logger.log(POILogger.WARN, "\"Pictures\" stream may have ended early. In some circumstances, this is not a problem; " +
+ "in others, this could indicate a corrupt file");
+ break;
+ }
// Build the PictureData object from the data
try {
HSLFPictureData pict = HSLFPictureData.create(pt);