From: Yegor Kozlov Date: Tue, 11 Nov 2008 10:07:08 +0000 (+0000) Subject: fixed bug#46182: Slideshow.readPictures() skips pictures with invalid headers X-Git-Tag: REL_3_5_BETA4~37 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c5b948d9aa74f9ea912436faf31261d4da69053b;p=poi.git fixed bug#46182: Slideshow.readPictures() skips pictures with invalid headers git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@713009 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index 259caeae30..42497beb12 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -37,6 +37,7 @@ + 46182 - fixed Slideshow.readPictures() to skip pictures with invalid headers 46137 - Handle odd files with a ContinueRecord after EOFRecord Fixed problem with linking shared formulas when ranges overlap 45784 - More fixes to SeriesTextRecord diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 3cef6f652c..baec54a045 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,7 +34,8 @@ - 46137 - Handle odd files with a ContinueRecord after EOFRecord + 46182 - fixed Slideshow.readPictures() to skip pictures with invalid headers + 46137 - Handle odd files with a ContinueRecord after EOFRecord Fixed problem with linking shared formulas when ranges overlap 45784 - More fixes to SeriesTextRecord 46033 - fixed TableCell to correctly set text type diff --git a/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java b/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java index 217ab7bc88..8273d87cc5 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java +++ b/src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java @@ -333,17 +333,16 @@ public final class HSLFSlideShow extends POIDocument { 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 { - // Copy the data, ready to pass to PictureData - byte[] imgdata = new byte[imgsize]; - if(imgsize > 0) { - System.arraycopy(pictstream, pos, imgdata, 0, imgdata.length); - } - // Build the PictureData object from the data try { PictureData pict = PictureData.create(type - 0xF018); - pict.setRawData(imgdata); - pict.setOffset(offset); + + // Copy the data, ready to pass to PictureData + byte[] imgdata = new byte[imgsize]; + System.arraycopy(pictstream, pos, imgdata, 0, imgdata.length); + pict.setRawData(imgdata); + + pict.setOffset(offset); p.add(pict); } catch(IllegalArgumentException e) { logger.log(POILogger.ERROR, "Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");