]> source.dussan.org Git - poi.git/commitdiff
fixed bug#46182: Slideshow.readPictures() skips pictures with invalid headers
authorYegor Kozlov <yegor@apache.org>
Tue, 11 Nov 2008 10:07:08 +0000 (10:07 +0000)
committerYegor Kozlov <yegor@apache.org>
Tue, 11 Nov 2008 10:07:08 +0000 (10:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@713009 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/status.xml
src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java

index 259caeae3014e80efa98925b9c2c186959dec3a4..42497beb12930426fc1980dbe0c77328b9c0d95b 100644 (file)
@@ -37,6 +37,7 @@
 
                <!-- Don't forget to update status.xml too! -->
         <release version="3.5-beta4" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">46182 - fixed Slideshow.readPictures() to skip pictures with invalid headers</action>
            <action dev="POI-DEVELOPERS" type="fix">46137 - Handle odd files with a ContinueRecord after EOFRecord</action>
            <action dev="POI-DEVELOPERS" type="fix">Fixed problem with linking shared formulas when ranges overlap</action>
            <action dev="POI-DEVELOPERS" type="fix">45784 - More fixes to SeriesTextRecord</action>
index 3cef6f652cff6811bbe2e8815930001b9b9ea83b..baec54a0454d92c4c6f2a478b2d2a57609a1fe83 100644 (file)
@@ -34,7 +34,8 @@
        <!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.5-beta4" date="2008-??-??">
-                       <action dev="POI-DEVELOPERS" type="fix">46137 - Handle odd files with a ContinueRecord after EOFRecord</action>
+           <action dev="POI-DEVELOPERS" type="fix">46182 - fixed Slideshow.readPictures() to skip pictures with invalid headers</action>
+                        <action dev="POI-DEVELOPERS" type="fix">46137 - Handle odd files with a ContinueRecord after EOFRecord</action>
            <action dev="POI-DEVELOPERS" type="fix">Fixed problem with linking shared formulas when ranges overlap</action>
            <action dev="POI-DEVELOPERS" type="fix">45784 - More fixes to SeriesTextRecord</action>
            <action dev="POI-DEVELOPERS" type="fix">46033 - fixed TableCell to correctly set text type</action>
index 217ab7bc88458e9a186772f28645efd66379c399..8273d87cc523e2fbf9c18f0ddd279cdfd0d51f3b 100644 (file)
@@ -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!");