Skip to content

Commit cc4da87

Browse files
committed
Update Tokio and ZIP to address RustSec advisories
1 parent 21a1908 commit cc4da87

5 files changed

Lines changed: 41 additions & 10 deletions

File tree

‎Cargo.lock‎

Lines changed: 23 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ nom = { version = "^8.0", default-features = false, features = ["alloc"] }
1919
parking_lot = { version = "^0.12", default-features = false }
2020
tracing = { version = "^0.1", default-features = false, features = ["attributes"] }
2121

22-
tokio = { version = "^1.52", features = ["macros"] }
22+
tokio = { version = "^1.54.1", features = ["macros"] }
2323

2424
classfile = { path = "classfile", version = "0.3.2" }
2525
jvm = { path = "jvm", version = "0.3.2" }

‎rustjava-runtime/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ chrono = { version = "^0.4", default-features = false }
2020
encoding_rs = { version = "^0.8", features = ["alloc"], default-features = false }
2121
tracing-attributes = { version = "<0.1.29" } # Pin this to avoid compile error with no-std https://github.com/tokio-rs/tracing/issues/3388
2222
url = { version = "^2.5", default-features = false }
23-
zip = { version = "^8.6", features = ["deflate"], default-features = false }
23+
zip = { version = "^9.0.5", features = ["deflate"], default-features = false }
2424

2525
jvm = { workspace = true }
2626
jvm-class-proto = { workspace = true }

‎rustjava-runtime/src/classes/java/util/jar/jar_file.rs‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,18 @@ impl JarFile {
125125
if manifest_file.is_null() {
126126
let name = {
127127
let zip = ZipFile::get_zip_archive(jvm, &ClassInstanceRef::from(this.instance.clone())).await?;
128-
zip.file_names()
129-
.find(|name| name.eq_ignore_ascii_case("META-INF/MANIFEST.MF"))
130-
.map(ToString::to_string)
128+
let mut manifest_name = None;
129+
for name in zip.file_names() {
130+
let name = match name {
131+
Ok(name) => name,
132+
Err(err) => return Err(jvm.exception("java/util/zip/ZipException", &err.to_string()).await),
133+
};
134+
if name.eq_ignore_ascii_case("META-INF/MANIFEST.MF") {
135+
manifest_name = Some(name.into_owned());
136+
break;
137+
}
138+
}
139+
manifest_name
131140
};
132141
let Some(name) = name else {
133142
return Ok(None.into());

‎rustjava-runtime/src/classes/java/util/zip/zip_file.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ impl ZipFile {
110110
tracing::debug!("java.util.zip.ZipFile::entries({this:?})");
111111

112112
let zip = Self::get_zip_archive(jvm, &this).await?;
113-
let names = zip.file_names().map(|x| x.to_string()).collect::<Vec<_>>();
113+
let names = match zip.file_names().collect::<core::result::Result<Vec<_>, _>>() {
114+
Ok(names) => names,
115+
Err(err) => return Err(jvm.exception("java/util/zip/ZipException", &err.to_string()).await),
116+
};
114117

115118
let mut name_array = jvm.instantiate_array("Ljava/lang/String;", names.len() as _).await?;
116119
for (i, name) in names.iter().enumerate() {

0 commit comments

Comments
 (0)