Skip to content

Commit

Permalink
Bug 66425: Avoid a NullPointerException found via oss-fuzz
Browse files Browse the repository at this point in the history
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
  • Loading branch information
centic9 committed Sep 11, 2023
1 parent dbd8808 commit e666d37
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public void startElement(String uri, String localName, String name,
} 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(" ");
}
}
Expand Down Expand Up @@ -287,7 +287,9 @@ public void endElement(String uri, String localName, String name) throws SAXExce
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);
Expand Down
Binary file not shown.
Binary file modified test-data/spreadsheet/stress.xls
Binary file not shown.

0 comments on commit e666d37

Please sign in to comment.