From 5ed77b505447fa98cd58cfcbe10c44517ef0de3a Mon Sep 17 00:00:00 2001 From: Imbris Date: Wed, 1 Apr 2020 20:03:15 -0400 Subject: [PATCH] Fix security --- Cargo.lock | 18 ++++++++++++++---- world/Cargo.toml | 2 +- world/src/sim/util.rs | 7 ++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 311406a162..98cf25c4af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -331,9 +331,13 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "bitvec" -version = "0.15.2" +version = "0.17.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993f74b4c99c1908d156b8d2e0fb6277736b0ecbd833982fd1241d39b2766a6" +checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" +dependencies = [ + "either", + "radium", +] [[package]] name = "blake2b_simd" @@ -410,9 +414,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.2.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f359dc14ff8911330a51ef78022d376f25ed00248912803b58f00cb1c27f742" +checksum = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" [[package]] name = "byteorder" @@ -3401,6 +3405,12 @@ dependencies = [ "proc-macro2 1.0.9", ] +[[package]] +name = "radium" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" + [[package]] name = "rand" version = "0.4.6" diff --git a/world/Cargo.toml b/world/Cargo.toml index 0784d933a9..0ff1838510 100644 --- a/world/Cargo.toml +++ b/world/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] bincode = "1.2.0" common = { package = "veloren-common", path = "../common" } -bitvec = "0.15.2" +bitvec = "0.17.4" image = "0.22.3" itertools = "0.8.2" vek = "0.10.0" diff --git a/world/src/sim/util.rs b/world/src/sim/util.rs index fa138c40bf..e9f9cd816f 100644 --- a/world/src/sim/util.rs +++ b/world/src/sim/util.rs @@ -1,5 +1,5 @@ use super::WORLD_SIZE; -use bitvec::prelude::{bitbox, bitvec, BitBox}; +use bitvec::prelude::{bitbox, BitBox}; use common::{terrain::TerrainChunkSize, vol::RectVolSize}; use noise::{MultiFractal, NoiseFn, Perlin, Point2, Point3, Point4, Seedable}; use num::Float; @@ -322,10 +322,11 @@ pub fn get_oceans(oldh: impl Fn(usize) -> F + Sync) -> BitBox { while let Some(chunk_idx) = stack.pop() { // println!("Ocean chunk {:?}: {:?}", uniform_idx_as_vec2(chunk_idx), // oldh(chunk_idx)); - if *is_ocean.at(chunk_idx) { + let mut is_ocean = is_ocean.get_mut(chunk_idx).unwrap(); + if *is_ocean { continue; } - *is_ocean.at(chunk_idx) = true; + *is_ocean = true; stack.extend(neighbors(chunk_idx).filter(|&neighbor_idx| { // println!("Ocean neighbor: {:?}: {:?}", uniform_idx_as_vec2(neighbor_idx), // oldh(neighbor_idx));