<changes>
<release version="3.7-SNAPSHOT" date="2010-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">43670 - Improve HDGF ChunkV11 separator detection, and short string detection, to solve the "Negative length of ChunkHeader" problem</action>
<action dev="POI-DEVELOPERS" type="add">48617 - Optionally allow the overriding of the Locale used by DataFormatter to control how the default number and date formats should look</action>
<action dev="POI-DEVELOPERS" type="add">New event based xssf text extractor (XSSFEventBasedExcelExtractor)</action>
<action dev="POI-DEVELOPERS" type="add">ExtractorFactory can now be told to prefer Event Based extractors (current Excel only) on a per-thread or overall basis</action>
// A Little Endian String
// Starts 8 bytes into the data segment
// Ends at end of data, or 00 00
+
+ // Ensure we have enough data
+ if(contents.length < 8) {
+ command.value = "";
+ break;
+ }
+
+ // Find the end point
int startsAt = 8;
int endsAt = startsAt;
for(int j=startsAt; j<contents.length-1 && endsAt == startsAt; j++) {
if(endsAt == startsAt) {
endsAt = contents.length;
}
-
+
int strLen = (endsAt-startsAt) / 2;
command.value = StringUtil.getFromUnicodeLE(contents, startsAt, strLen);
break;
if(hasTrailer()) { return true; }
if(unknown2 == 2 && unknown3 == 0x55) { return true; }
+ if(unknown2 == 2 && unknown3 == 0x54 && type == 0xa9) { return true; }
if(unknown2 == 2 && unknown3 == 0x54 && type == 0xaa) { return true; }
+ if(unknown2 == 2 && unknown3 == 0x54 && type == 0xb4) { return true; }
+ if(unknown2 == 2 && unknown3 == 0x54 && type == 0xb6) { return true; }
if(unknown2 == 3 && unknown3 != 0x50) { return true; }
if(type == 0x69) { return true; }
}
/**
- * Tests that we can open a problematic file, that initially
- * appears to have a negative chunk length
+ * Tests that we can open a problematic file, that used to
+ * break with a negative chunk length
*/
- public void DISABLEDtestNegativeChunkLength() throws Exception {
+ public void testNegativeChunkLength() throws Exception {
fs = new POIFSFileSystem(_dgTests.openResourceAsStream("NegativeChunkLength.vsd"));
HDGFDiagram hdgf = new HDGFDiagram(fs);
assertNotNull(hdgf);
+
+ // And another file
+ fs = new POIFSFileSystem(_dgTests.openResourceAsStream("NegativeChunkLength2.vsd"));
+ hdgf = new HDGFDiagram(fs);
+ assertNotNull(hdgf);
}
}