fix(worker): V1-2.3 hostile corpus through verify, verdict and memory caps aligned
This commit is contained in:
1 parent
7043d39ae0
commit
6aa85fe7e4
7 files changed
+67
-10
No files matched your search
@@ -201,8 +201,14 @@ fn chain_reviewed(levels: usize) -> Value {
|
||||
/// The framed input of `document` drawn on `SHEET_DRAWING`, the document also as its base
|
||||
/// (the base path is traced too); empty on a framing error.
|
||||
pub fn sheet_frame(document: &Value) -> Vec<u8> {
|
||||
sheet_frame_on(document, SHEET_DRAWING.as_bytes())
|
||||
}
|
||||
|
||||
/// The same framed input with `drawing` as the main view's drawing, its row matching its
|
||||
/// bytes (size and sha256), so the core reads it.
|
||||
pub fn sheet_frame_on(document: &Value, drawing: &[u8]) -> Vec<u8> {
|
||||
let text = document.to_string();
|
||||
let sha256 = sha256_hex(SHEET_DRAWING.as_bytes());
|
||||
let sha256 = sha256_hex(drawing);
|
||||
let input = VerdictInput {
|
||||
binding: sheet_binding(),
|
||||
document: &text,
|
||||
@@ -210,8 +216,8 @@ pub fn sheet_frame(document: &Value) -> Vec<u8> {
|
||||
drawings: vec![VerdictDrawing {
|
||||
asset_id: SHEET_ASSET,
|
||||
sha256: &sha256,
|
||||
byte_size: SHEET_DRAWING.len() as u64,
|
||||
bytes: Some(SHEET_DRAWING.as_bytes()),
|
||||
byte_size: drawing.len() as u64,
|
||||
bytes: Some(drawing),
|
||||
}],
|
||||
};
|
||||
verify_frame::encode(&input).unwrap_or_default()
|
||||
|
||||
@@ -34,8 +34,10 @@ pub const MIN_LIBWEBP_VERSION: (u8, u8, u8) = (1, 6, 0);
|
||||
pub const VERIFY_MAX_INPUT_BYTES: usize = 12 * 1024 * 1024;
|
||||
/// Largest frame header (ids and drawing rows, a few KiB in practice).
|
||||
pub const VERIFY_MAX_HEADER_BYTES: usize = 64 * 1024;
|
||||
/// Largest verdict the parent reads (= SQL `sheet_verification_max_verdict_bytes`).
|
||||
pub const VERIFY_MAX_OUTPUT_BYTES: usize = 4 * 1024 * 1024;
|
||||
/// Largest verdict the parent reads: below SQL `sheet_verification_max_verdict_bytes` (4 MiB,
|
||||
/// measured on `jsonb::text`, whose separators make the same verdict longer than the compact
|
||||
/// child output), so a verdict the child may write is one SQL measures within its cap.
|
||||
pub const VERIFY_MAX_OUTPUT_BYTES: usize = 3 * 1024 * 1024;
|
||||
/// Hard address-space cap of the `verify` child (`RLIMIT_AS`).
|
||||
pub const VERIFY_ADDRESS_SPACE_BYTES: u64 = 1024 * 1024 * 1024;
|
||||
/// CPU-time cap of the `verify` child (`RLIMIT_CPU`, seconds).
|
||||
|
||||
Reference in new issue
Block a user