aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2015-02-13 19:14:14 +0000
committerDominik Stadler <centic@apache.org>2015-02-13 19:14:14 +0000
commit5b42301a451bd4c4598b6f85bab7b1e53b72aef4 (patch)
tree7c0c15030f14a427ee07676a39b50c9251bf0312 /src/java
parentfaa857592389d1ca35ae8c29877424bfcb8ac048 (diff)
downloadpoi-5b42301a451bd4c4598b6f85bab7b1e53b72aef4.tar.gz
poi-5b42301a451bd4c4598b6f85bab7b1e53b72aef4.zip
Bug 57456: Fix reading XLS with empty SSTRecord where Excel puts some random number in unique-strings-count-field
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1659650 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/poi/hssf/record/SSTRecord.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/hssf/record/SSTRecord.java b/src/java/org/apache/poi/hssf/record/SSTRecord.java
index aadd58619b..abbf909681 100644
--- a/src/java/org/apache/poi/hssf/record/SSTRecord.java
+++ b/src/java/org/apache/poi/hssf/record/SSTRecord.java
@@ -243,7 +243,14 @@ public final class SSTRecord extends ContinuableRecord {
field_1_num_strings = in.readInt();
field_2_num_unique_strings = in.readInt();
field_3_strings = new IntMapper<UnicodeString>();
+
deserializer = new SSTDeserializer(field_3_strings);
+ // Bug 57456: some Excel Sheets send 0 as field=1, but have some random number in field_2,
+ // we should not try to read the strings in this case.
+ if(field_1_num_strings == 0) {
+ field_2_num_unique_strings = 0;
+ return;
+ }
deserializer.manufactureStrings( field_2_num_unique_strings, in );
}