From: Nick Burch Date: Thu, 28 Jan 2010 12:05:13 +0000 (+0000) Subject: Apply patch from Jukka from bug #43670 to improve HDGF v11 Separator detection, and... X-Git-Tag: REL_3_7_BETA1~113 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=161a341e6c4ad5ea30288c598d5d5887ae4accf9;p=poi.git Apply patch from Jukka from bug #43670 to improve HDGF v11 Separator detection, and handle short strings better, hopefully solving the Negative length of ChunkHeader issue git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@904052 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index b0ae08f9b9..28c8f53b0f 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 43670 - Improve HDGF ChunkV11 separator detection, and short string detection, to solve the "Negative length of ChunkHeader" problem 48617 - Optionally allow the overriding of the Locale used by DataFormatter to control how the default number and date formats should look New event based xssf text extractor (XSSFEventBasedExcelExtractor) ExtractorFactory can now be told to prefer Event Based extractors (current Excel only) on a per-thread or overall basis diff --git a/src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java b/src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java index 64314ee5f0..595ca9ad92 100644 --- a/src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java +++ b/src/scratchpad/src/org/apache/poi/hdgf/chunks/Chunk.java @@ -180,6 +180,14 @@ public final class Chunk { // 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