diff options
author | Dominik Stadler <centic@apache.org> | 2023-08-12 14:53:58 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2023-08-12 14:53:58 +0000 |
commit | 733d3d10ead2619e6bf10a1f431fd659cf178f03 (patch) | |
tree | b821a10a2a4a062464f6fad2b61dbb7c6ab45d74 /poi-ooxml | |
parent | 757708fb546d3e2391b36cb5c656a64ec6ae5704 (diff) | |
download | poi-733d3d10ead2619e6bf10a1f431fd659cf178f03.tar.gz poi-733d3d10ead2619e6bf10a1f431fd659cf178f03.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=61390
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911615 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r-- | poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagePartName.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagePartName.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagePartName.java index 7883c6d2ae..43853dd3b7 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagePartName.java +++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagePartName.java @@ -201,7 +201,7 @@ public final class PackagePartName implements Comparable<PackagePartName> { } String uriPath = partURI.getPath(); - if (uriPath.length() == 0 + if (uriPath == null || uriPath.isEmpty() || ((uriPath.length() == 1) && (uriPath.charAt(0) == PackagingURIHelper.FORWARD_SLASH_CHAR))) { throw new InvalidFormatException( "A part name shall not be empty [M1.1]: " |