Author: centic
Date: Thu Sep 14 09:23:02 2023
New Revision: 1912303
URL: http://svn.apache.org/viewvc?rev=1912303&view=rev
Log:
Bug 66425: Avoid NullPointerExceptions found via poi-fuzz
We try to avoid throwing NullPointerException, but it was possible
to trigger one here
Added:
poi/trunk/test-data/document/crash-517626e815e0afa9decd0ebb6d1dee63fb9907dd.docx
(with props)
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java
Modified:
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java
URL:
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java?rev=1912303&r1=1912302&r2=1912303&view=diff
==============================================================================
---
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java
(original)
+++
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java
Thu Sep 14 09:23:02 2023
@@ -1430,8 +1430,9 @@ public class XWPFRun implements ISDTCont
}
if (o instanceof CTFtnEdnRef) {
CTFtnEdnRef ftn = (CTFtnEdnRef) o;
+ final int i = ftn.getId() == null ? -1 : ftn.getId().intValue();
String footnoteRef =
ftn.getDomNode().getLocalName().equals("footnoteReference") ?
- "[footnoteRef:" + ftn.getId().intValue() + "]" :
"[endnoteRef:" + ftn.getId().intValue() + "]";
+ "[footnoteRef:" + i + "]" : "[endnoteRef:" + i + "]";
text.append(footnoteRef);
}
}
Added:
poi/trunk/test-data/document/crash-517626e815e0afa9decd0ebb6d1dee63fb9907dd.docx
URL:
http://svn.apache.org/viewvc/poi/trunk/test-data/document/crash-517626e815e0afa9decd0ebb6d1dee63fb9907dd.docx?rev=1912303&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
poi/trunk/test-data/document/crash-517626e815e0afa9decd0ebb6d1dee63fb9907dd.docx
------------------------------------------------------------------------------
--- svn:mime-type (added)
+++ svn:mime-type Thu Sep 14 09:23:02 2023
@@ -0,0 +1 @@
+application/vnd.openxmlformats-officedocument.wordprocessingml.document
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]