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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912253 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
centic9 committed Sep 11, 2023
1 parent 481c00b commit cc9d1c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Licensed to the Apache Software Foundation (ASF) under one or more
==================================================================== */
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;
Expand All @@ -38,7 +40,9 @@ public XWPFCommentsDecorator(XWPFParagraph paragraph, XWPFParagraphDecorator nex
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(": ")
Expand Down
Binary file not shown.

0 comments on commit cc9d1c7

Please sign in to comment.