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
This commit is contained in:
Dominik Stadler 2023-08-11 14:46:04 +00:00
parent d152861036
commit f034ca26b9
3 changed files with 5 additions and 3 deletions

View File

@ -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) {

Binary file not shown.