diff options
author | Maxim Valyanskiy <maxcom@apache.org> | 2011-01-27 12:42:12 +0000 |
---|---|---|
committer | Maxim Valyanskiy <maxcom@apache.org> | 2011-01-27 12:42:12 +0000 |
commit | d86df59b5722ae786ea1f2ca4899db1f25b07d11 (patch) | |
tree | 0ba1221e5fe4ee1fc405a91f0b2193e426c8db3e | |
parent | fa799dd7e2144eb8712c37549330493f12cbecaf (diff) | |
download | poi-d86df59b5722ae786ea1f2ca4899db1f25b07d11.tar.gz poi-d86df59b5722ae786ea1f2ca4899db1f25b07d11.zip |
hwpf: ignore incorrect ListFormatOverride reference that causes IndexOutOfBoundException
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1064110 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java | 4 | ||||
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hwpf/usermodel/ListEntry.java | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java index 9124c1fb20..b8529f55f0 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java @@ -165,6 +165,10 @@ public final class ListTables return _overrideList.get(lfoIndex - 1); } + public int getOverrideCount() { + return _overrideList.size(); + } + public int getOverrideIndexFromListID(int lstid) { int returnVal = -1; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ListEntry.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ListEntry.java index 6f29cf0d3c..ba5bec75b5 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ListEntry.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ListEntry.java @@ -37,7 +37,7 @@ public final class ListEntry { super(papx, parent); - if(tables != null) { + if(tables != null && _props.getIlfo() < tables.getOverrideCount()) { ListFormatOverride override = tables.getOverride(_props.getIlfo()); _overrideLevel = override.getOverrideLevel(_props.getIlvl()); _level = tables.getLevel(override.getLsid(), _props.getIlvl()); |