Projects
openEuler:24.03:SP1:Everything
openjdk-1.8.0
_service:tar_scm:add-8146431-j.u.z.ZipFile.getE...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:add-8146431-j.u.z.ZipFile.getEntry-throws-AIOOBE.patch of Package openjdk-1.8.0
From b6a24b666a1c7536e35afaba4057cc8eac6fe48f Mon Sep 17 00:00:00 2001 Date: Thu, 21 Sep 2023 15:25:03 +0800 Subject: add 8146431-j.u.z.ZipFile.getEntry-throws-AIOOBE --- jdk/src/share/classes/java/util/zip/ZipFile.java | 2 +- jdk/test/java/util/zip/ZipFile/TestZipFile.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/java/util/zip/ZipFile.java b/jdk/src/share/classes/java/util/zip/ZipFile.java index 38b642bdc..36135a9c0 100644 --- a/jdk/src/share/classes/java/util/zip/ZipFile.java +++ b/jdk/src/share/classes/java/util/zip/ZipFile.java @@ -1313,7 +1313,7 @@ class ZipFile implements ZipConstants, Closeable { idx = getEntryNext(idx); } /* If not addSlash, or slash is already there, we are done */ - if (!addSlash || name[name.length - 1] == '/') { + if (!addSlash || name.length == 0 || name[name.length - 1] == '/') { return -1; } // Add a slash to the hash code diff --git a/jdk/test/java/util/zip/ZipFile/TestZipFile.java b/jdk/test/java/util/zip/ZipFile/TestZipFile.java index 30bae3bb9..773f47558 100644 --- a/jdk/test/java/util/zip/ZipFile/TestZipFile.java +++ b/jdk/test/java/util/zip/ZipFile/TestZipFile.java @@ -24,7 +24,7 @@ /* * @test - * @bug 8142508 + * @bug 8142508 8146431 * @summary Tests various ZipFile apis * @run main/manual TestZipFile */ @@ -230,6 +230,13 @@ public class TestZipFile { } static void doTest0(Zip zip, ZipFile zf) throws Throwable { + // (0) check zero-length entry name, no AIOOBE + try { + check(zf.getEntry("") == null);; + } catch (Throwable t) { + unexpected(t); + } + List<ZipEntry> list = new ArrayList(zip.entries.keySet()); // (1) check entry list, in expected order if (!check(Arrays.equals( -- 2.22.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2