diff options
author | Dominik Stadler <centic@apache.org> | 2023-08-11 14:46:04 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2023-08-11 14:46:04 +0000 |
commit | f034ca26b98fa7126398a51b190b0de2f563a225 (patch) | |
tree | 8a702dea0ca973956f1d1f0efc9b3ee53f853169 /poi-scratchpad/src | |
parent | d15286103648b5cbfadfc6eeec132f224b49e2ec (diff) | |
download | poi-f034ca26b98fa7126398a51b190b0de2f563a225.tar.gz poi-f034ca26b98fa7126398a51b190b0de2f563a225.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=61372
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911603 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-scratchpad/src')
-rw-r--r-- | poi-scratchpad/src/main/java/org/apache/poi/hdgf/extractor/VisioTextExtractor.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hdgf/extractor/VisioTextExtractor.java b/poi-scratchpad/src/main/java/org/apache/poi/hdgf/extractor/VisioTextExtractor.java index 194075fe04..30eab3e843 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hdgf/extractor/VisioTextExtractor.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hdgf/extractor/VisioTextExtractor.java @@ -38,7 +38,7 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; * can return the text for you (example: for use with Lucene). */ public final class VisioTextExtractor implements POIOLE2TextExtractor { - private HDGFDiagram hdgf; + private final HDGFDiagram hdgf; private boolean doCloseFilesystem = true; public VisioTextExtractor(HDGFDiagram hdgf) { @@ -72,8 +72,10 @@ public final class VisioTextExtractor implements POIOLE2TextExtractor { private void findText(Stream stream, List<String> text) { if(stream instanceof PointerContainingStream) { PointerContainingStream ps = (PointerContainingStream)stream; - for(final Stream substream : ps.getPointedToStreams()) { - findText(substream, text); + if (ps.getPointedToStreams() != null) { + for (final Stream substream : ps.getPointedToStreams()) { + findText(substream, text); + } } } if(stream instanceof ChunkStream) { |