decompression fix for OOM

This commit is contained in:
John Smith 2023-08-19 18:13:30 -04:00
parent 623e6621f3
commit eae839e484
5 changed files with 10 additions and 5 deletions

View File

@ -93,6 +93,11 @@ build-linux-amd64:
RUN cargo build --target x86_64-unknown-linux-gnu --release -p veilid-server -p veilid-cli -p veilid-tools -p veilid-core
SAVE ARTIFACT ./target/x86_64-unknown-linux-gnu AS LOCAL ./target/artifacts/x86_64-unknown-linux-gnu
build-linux-amd64-debug:
FROM +code-linux
RUN cargo build --target x86_64-unknown-linux-gnu -p veilid-server -p veilid-cli -p veilid-tools -p veilid-core
SAVE ARTIFACT ./target/x86_64-unknown-linux-gnu AS LOCAL ./target/artifacts/x86_64-unknown-linux-gnu
build-linux-arm64:
FROM +code-linux
RUN cargo zigbuild --target aarch64-unknown-linux-gnu --release -p veilid-server -p veilid-cli -p veilid-tools -p veilid-core

View File

@ -214,8 +214,7 @@ impl Envelope {
);
// Decompress body
let body = decompress_size_prepended(&body)
.map_err(|e| VeilidAPIError::parse_error("failed to decompress", e))?;
let body = decompress_size_prepended(&body, Some(MAX_ENVELOPE_SIZE))?;
Ok(body)
}

View File

@ -89,7 +89,6 @@ use cfg_if::*;
use enumset::*;
use eyre::{bail, eyre, Report as EyreReport, Result as EyreResult, WrapErr};
use futures_util::stream::FuturesUnordered;
use lz4_flex::block::{compress_prepend_size, decompress_size_prepended};
use parking_lot::*;
use schemars::{schema_for, JsonSchema};
use serde::*;

View File

@ -147,10 +147,10 @@ impl TableDB {
(&data[0..NONCE_LENGTH]).try_into().unwrap(),
&di.key,
);
decompress_size_prepended(&out)
decompress_size_prepended(&out, None)
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))
} else {
decompress_size_prepended(data)
decompress_size_prepended(data, None)
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))
}
}

View File

@ -5,3 +5,5 @@ pub mod serialize_arc;
mod serialize_json;
pub mod serialize_range_set_blaze;
pub use serialize_json::*;
mod compression;
pub use compression::*;