diff options
author | Dominik Stadler <centic@apache.org> | 2023-09-11 18:25:06 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2023-09-11 18:25:06 +0000 |
commit | e666d3756eaea55a138e7b2b319bc70ad28bf74d (patch) | |
tree | 8503ce56c95a4332f65fde1134c03f92d571ffed /poi-ooxml | |
parent | dbd88084324d2716517197e76d1feb4b224e1773 (diff) | |
download | poi-e666d3756eaea55a138e7b2b319bc70ad28bf74d.tar.gz poi-e666d3756eaea55a138e7b2b319bc70ad28bf74d.zip |
Bug 66425: Avoid a NullPointerException found via oss-fuzz
We try to avoid throwing NullPointerException, but it was possible
to trigger one here with a specially crafted input-file
Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62208
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912251 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java index 07d00bd99a..590251960a 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java @@ -259,7 +259,7 @@ public class ReadOnlySharedStringsTable extends DefaultHandler implements Shared } else if ("rPh".equals(localName)) { inRPh = true; //append space...this assumes that rPh always comes after regular <t> - if (includePhoneticRuns && characters.length() > 0) { + if (includePhoneticRuns && characters != null && characters.length() > 0) { characters.append(" "); } } @@ -287,7 +287,9 @@ public class ReadOnlySharedStringsTable extends DefaultHandler implements Shared public void characters(char[] ch, int start, int length) throws SAXException { if (tIsOpen) { if (inRPh && includePhoneticRuns) { - characters.append(ch, start, length); + if (characters != null) { + characters.append(ch, start, length); + } } else if (! inRPh){ if (characters != null) { characters.append(ch, start, length); |