From d86df59b5722ae786ea1f2ca4899db1f25b07d11 Mon Sep 17 00:00:00 2001 From: Maxim Valyanskiy Date: Thu, 27 Jan 2011 12:42:12 +0000 Subject: [PATCH] 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 --- src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java | 4 ++++ .../src/org/apache/poi/hwpf/usermodel/ListEntry.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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()); -- 2.39.5