aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Crownover <[email protected]>2022-03-26 01:48:20 +0000
committerZach Crownover <[email protected]>2022-03-26 01:48:20 +0000
commit989c30e2498c5ef65949761764297f9df864d074 (patch)
tree95e5670067355781dadbd6abf2e2574f43813bf6
parent9cd41c0cfdc2fa2fcb8261ff3e1446d98495c991 (diff)
RUSTSEC-2020-0077
Migrate from the abandoned memmap library to the now maintained fork of memmap2
-rw-r--r--b3sum/Cargo.lock9
-rw-r--r--b3sum/Cargo.toml2
-rw-r--r--b3sum/src/main.rs8
3 files changed, 9 insertions, 10 deletions
diff --git a/b3sum/Cargo.lock b/b3sum/Cargo.lock
index 98b1b93..0874b3b 100644
--- a/b3sum/Cargo.lock
+++ b/b3sum/Cargo.lock
@@ -46,7 +46,7 @@ dependencies = [
"clap",
"duct",
"hex",
- "memmap",
+ "memmap2",
"rayon",
"tempfile",
"wild",
@@ -280,13 +280,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
-name = "memmap"
-version = "0.7.0"
+name = "memmap2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
+checksum = "057a3db23999c867821a7a59feb06a578fcb03685e983dff90daf9e7d24ac08f"
dependencies = [
"libc",
- "winapi",
]
[[package]]
diff --git a/b3sum/Cargo.toml b/b3sum/Cargo.toml
index 2f68269..3c567b1 100644
--- a/b3sum/Cargo.toml
+++ b/b3sum/Cargo.toml
@@ -18,7 +18,7 @@ anyhow = "1.0.25"
blake3 = { version = "1", path = "..", features = ["rayon"] }
clap = "3.0.5"
hex = "0.4.0"
-memmap = "0.7.0"
+memmap2 = "0.5.3"
rayon = "1.2.1"
wild = "2.0.3"
diff --git a/b3sum/src/main.rs b/b3sum/src/main.rs
index 7b7fd60..f2f411a 100644
--- a/b3sum/src/main.rs
+++ b/b3sum/src/main.rs
@@ -187,7 +187,7 @@ impl Args {
}
enum Input {
- Mmap(io::Cursor<memmap::Mmap>),
+ Mmap(io::Cursor<memmap2::Mmap>),
File(File),
Stdin,
}
@@ -276,7 +276,7 @@ fn copy_wide(mut reader: impl Read, hasher: &mut blake3::Hasher) -> io::Result<u
// Mmap a file, if it looks like a good idea. Return None in cases where we
// know mmap will fail, or if the file is short enough that mmapping isn't
// worth it. However, if we do try to mmap and it fails, return the error.
-fn maybe_memmap_file(file: &File) -> Result<Option<memmap::Mmap>> {
+fn maybe_memmap_file(file: &File) -> Result<Option<memmap2::Mmap>> {
let metadata = file.metadata()?;
let file_size = metadata.len();
Ok(if !metadata.is_file() {
@@ -297,9 +297,9 @@ fn maybe_memmap_file(file: &File) -> Result<Option<memmap::Mmap>> {
// Explicitly set the length of the memory map, so that filesystem
// changes can't race to violate the invariants we just checked.
let map = unsafe {
- memmap::MmapOptions::new()
+ memmap2::MmapOptions::new()
.len(file_size as usize)
- .map(&file)?
+ .map(file)?
};
Some(map)
})