Browse Source

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=62225

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912253 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_2_4
Dominik Stadler 8 months ago
parent
commit
cc9d1c7c70

+ 5
- 1
poi-ooxml/src/main/java/org/apache/poi/xwpf/model/XWPFCommentsDecorator.java View File

@@ -16,6 +16,8 @@
==================================================================== */
package org.apache.poi.xwpf.model;

import java.math.BigInteger;

import org.apache.poi.xwpf.usermodel.XWPFComment;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTMarkupRange;
@@ -38,7 +40,9 @@ public class XWPFCommentsDecorator extends XWPFParagraphDecorator {
commentText = new StringBuilder(64);

for (CTMarkupRange anchor : paragraph.getCTP().getCommentRangeStartArray()) {
if ((comment = paragraph.getDocument().getCommentByID(anchor.getId().toString())) != null) {
BigInteger id = anchor.getId();
if (id != null &&
(comment = paragraph.getDocument().getCommentByID(id.toString())) != null) {
commentText.append("\tComment by ")
.append(comment.getAuthor())
.append(": ")

BIN
test-data/document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-5564805011079168.docx View File


Loading…
Cancel
Save