file="${main.src.test}/org/apache/poi/hpsf/data"/>
<sysproperty key="POIFS.testdata.path"
file="${main.src.test}/org/apache/poi/poifs/data"/>
+ <sysproperty key="DDF.testdata.path"
+ file="${main.src.test}/org/apache/poi/ddf/data"/>
<sysproperty key="java.awt.headless" value="true"/>
<formatter type="plain"/>
<formatter type="xml"/>
<!-- Don't forget to update status.xml too! -->
<release version="3.1-beta1" date="2008-04-??">
+ <action dev="POI-DEVELOPERS" type="fix">44857 - Avoid OOM on unknown escher records when EscherMetafileBlip is incorrect</action>
<action dev="POI-DEVELOPERS" type="add">HSLF: Support for getting embedded sounds from slide show </action>
<action dev="POI-DEVELOPERS" type="add">HSLF: Initial support for rendering slides into images</action>
<action dev="POI-DEVELOPERS" type="add">HSLF: Support for getting OLE object data from slide show </action>
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.1-beta1" date="2008-04-??">
+ <action dev="POI-DEVELOPERS" type="fix">44857 - Avoid OOM on unknown escher records when EscherMetafileBlip is incorrect</action>
<action dev="POI-DEVELOPERS" type="add">HSLF: Support for getting embedded sounds from slide show </action>
<action dev="POI-DEVELOPERS" type="add">HSLF: Initial support for rendering slides into images</action>
<action dev="POI-DEVELOPERS" type="add">HSLF: Support for getting OLE object data from slide show </action>
field_6_fCompression = data[pos]; pos++;
field_7_fFilter = data[pos]; pos++;
- raw_pictureData = new byte[field_5_cbSave];
- System.arraycopy( data, pos, raw_pictureData, 0, field_5_cbSave );
+ // Bit of a snag - trusting field_5_cbSave results in inconsistent
+ // record size in some cases. So, just check the data left
+ int remainingBytes = bytesAfterHeader - 50;
+ raw_pictureData = new byte[remainingBytes];
+ System.arraycopy( data, pos, raw_pictureData, 0, remainingBytes );
// 0 means DEFLATE compression
// 0xFE means no compression
package org.apache.poi.ddf;
+import java.io.File;
+import java.io.FileInputStream;
+
import junit.framework.TestCase;
import org.apache.poi.util.HexRead;
import org.apache.poi.util.HexDump;
+import org.apache.poi.util.IOUtils;
public class TestEscherContainerRecord extends TestCase
{
- public void testFillFields() throws Exception
+ private String ESCHER_DATA_PATH;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ESCHER_DATA_PATH = System.getProperty("DDF.testdata.path");
+ }
+
+ public void testFillFields() throws Exception
{
EscherRecordFactory f = new DefaultEscherRecordFactory();
byte[] data = HexRead.readFromString( "0F 02 11 F1 00 00 00 00" );
assertEquals(18, r.getRecordSize());
}
+ /**
+ * We were having problems with reading too much data on an UnknownEscherRecord,
+ * but hopefully we now read the correct size.
+ */
+ public void testBug44857() throws Exception {
+ File f = new File(ESCHER_DATA_PATH, "Container.dat");
+ assertTrue(f.exists());
+
+ FileInputStream finp = new FileInputStream(f);
+ byte[] data = IOUtils.toByteArray(finp);
+
+ // This used to fail with an OutOfMemory
+ EscherContainerRecord record = new EscherContainerRecord();
+ record.fillFields(data, 0, new DefaultEscherRecordFactory());
+ }
}