From: Yegor Kozlov Date: Wed, 21 Mar 2007 14:04:32 +0000 (+0000) Subject: fixed bug 41384: Array index wrong in record creation X-Git-Tag: REL_3_0_RC2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=12dfa5656536c79f2f3a830014ca1403f2924f38;p=poi.git fixed bug 41384: Array index wrong in record creation git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@520893 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/Record.java b/src/scratchpad/src/org/apache/poi/hslf/record/Record.java index 6d925f4529..7094d3db31 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/record/Record.java +++ b/src/scratchpad/src/org/apache/poi/hslf/record/Record.java @@ -129,7 +129,7 @@ public abstract class Record // Record was horribly corrupt } pos += 8; - pos += rlen; + pos += rleni; } // Turn the vector into an array, and return diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/data/41384.ppt b/src/scratchpad/testcases/org/apache/poi/hslf/data/41384.ppt new file mode 100644 index 0000000000..7a206ecdd6 Binary files /dev/null and b/src/scratchpad/testcases/org/apache/poi/hslf/data/41384.ppt differ diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java new file mode 100644 index 0000000000..cfc3c95295 --- /dev/null +++ b/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java @@ -0,0 +1,53 @@ + +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ +package org.apache.poi.hslf.usermodel; + +import junit.framework.TestCase; +import org.apache.poi.hslf.HSLFSlideShow; +import org.apache.poi.hslf.model.Picture; + +import java.io.*; + +/** + * Testcases for bugs entered in bugzilla + * the Test name contains the bugzilla bug id + * + * @author Yegor Kozlov + */ +public class TestBugs extends TestCase { + protected String cwd = System.getProperty("HSLF.testdata.path"); + + /** + * Bug 41384: Array index wrong in record creation + */ + public void test41384() throws Exception { + FileInputStream is = new FileInputStream(new File(cwd, "41384.ppt")); + HSLFSlideShow hslf = new HSLFSlideShow(is); + is.close(); + + SlideShow ppt = new SlideShow(hslf); + assertTrue("No Exceptions while reading file", true); + + assertEquals(1, ppt.getSlides().length); + + PictureData[] pict = ppt.getPictureData(); + assertEquals(2, pict.length); + assertEquals(Picture.JPEG, pict[0].getType()); + assertEquals(Picture.JPEG, pict[1].getType()); + } +}