diff --git a/crates/engine/src/tests/plugins.rs b/crates/engine/src/tests/plugins.rs index 947a3ec42d..2c6026c85d 100644 --- a/crates/engine/src/tests/plugins.rs +++ b/crates/engine/src/tests/plugins.rs @@ -2017,6 +2017,23 @@ fn a_heavy_filter_installs_once_the_user_agrees() { assert!(install(&mut s, DESATURATE).get("budget").is_none()); } +/// A module that carries its manifest in a `vc_manifest` custom section is inspected and installed +/// without any of its code running: its start function traps and its `vc_manifest` export loops. +#[test] +fn a_plugin_with_a_manifest_section_installs_without_running() { + let mut s = session(); + let id = "test.engine.section"; + let manifest = format!(r#"{{"id":"{id}","name":"Test {id}","version":"1","kind":"filter","abi":1}}"#); + let extra = r#"(func (export "vc_manifest") (result i64) (loop $l (br $l)) (i64.const 0)) (func $trap unreachable) (start $trap)"#; + let data = vectorcraft_format::base64_encode(&wat::parse_str(tpl::sectioned(&manifest, tpl::ECHO, extra, 1)).unwrap()); + let inspected = run(&mut s, "plugin.inspect", json!({"dataBase64": data})); + assert_eq!(inspected["id"], id); + assert!(vectorcraft_plugins::registry::get(id).is_none(), "inspecting installs nothing"); + assert_eq!(run(&mut s, "plugin.install", json!({"dataBase64": data}))["id"], id); + assert!(vectorcraft_plugins::registry::get(id).is_some()); + run(&mut s, "plugin.remove", json!({"id": id})); +} + #[test] fn invalid_install_flags_are_refused() { let mut s = session(); diff --git a/crates/engine/tests/plugin_fuzz.rs b/crates/engine/tests/plugin_fuzz.rs index 20546835c1..d0b99e3efe 100644 --- a/crates/engine/tests/plugin_fuzz.rs +++ b/crates/engine/tests/plugin_fuzz.rs @@ -1,6 +1,6 @@ -//! Untrusted plug-ins never crash the app: mutated and garbage modules handed to `plugin.install`, -//! and plug-ins returning hostile output (random JSON in the object model's shape: huge or -//! malformed coordinates, unknown ids, broken paints and gradients, junk of every type) as object +//! Untrusted plug-ins never crash the app: mutated and garbage modules, and modules whose +//! `vc_manifest` custom section holds garbage, handed to `plugin.install`, and plug-ins returning +//! hostile output (random JSON in the object model's shape: huge or malformed coordinates, unknown ids, broken paints and gradients, junk of every type) as object //! filters (`plugin.run`) or live effects (`effect.apply`), and plug-ins running bulk memory //! instructions (`memory.fill`, `memory.copy`, `memory.init`, `data.drop`) on ranges in, at and past //! the ends of memory and the data segment, under small and default budgets. Each run must end as @@ -620,7 +620,11 @@ proptest! { } let mut s = rich_session(); s.execute("select.all", &json!({})).unwrap(); - for module in [bytes, [b"\0asm\x01\0\0\0".as_slice(), &garbage].concat(), garbage.clone()] { + // A module whose `vc_manifest` custom section holds the garbage. + let section = tpl::custom_section(vectorcraft_plugins::manifest::MANIFEST_SECTION, &garbage); + let sectioned = tpl::with_field(&tpl::module(&tpl::manifest("fuzz.section", "filter", "{}"), tpl::ECHO, "", 1), §ion).unwrap(); + let sectioned = wat::parse_str(sectioned).unwrap(); + for module in [bytes, [b"\0asm\x01\0\0\0".as_slice(), &garbage].concat(), garbage.clone(), sectioned] { let r = catch_quiet(|| { if let Ok(info) = install(&mut s, &module) { let _ = s.execute("plugin.run", &json!({"id": info["id"]})); diff --git a/crates/plugins/example/build.sh b/crates/plugins/example/build.sh index 1bedbc2fb0..614f683613 100644 --- a/crates/plugins/example/build.sh +++ b/crates/plugins/example/build.sh @@ -3,7 +3,9 @@ # Needs the wasm32-unknown-unknown target: `rustup target add wasm32-unknown-unknown`. set -eu cd "$(dirname "$0")" -cargo build --release --target wasm32-unknown-unknown +# An empty RUSTFLAGS replaces the `+simd128` flag that the repository's .cargo/config.toml sets for +# the web build: the plug-in host does not accept SIMD instructions. +RUSTFLAGS= cargo build --release --target wasm32-unknown-unknown out=target/wasm32-unknown-unknown/release/vectorcraft_plugin_desaturate.wasm cp "$out" ../tests/fixtures/desaturate.wasm echo "built $out ($(wc -c < "$out") bytes) -> crates/plugins/tests/fixtures/desaturate.wasm" diff --git a/crates/plugins/example/src/lib.rs b/crates/plugins/example/src/lib.rs index a1b08d8696..d5451860c5 100644 --- a/crates/plugins/example/src/lib.rs +++ b/crates/plugins/example/src/lib.rs @@ -12,6 +12,7 @@ const MANIFEST: &str = r#"{ "name": "Desaturate", "version": "1.0.0", "kind": "filter", + "abi": 1, "author": "VectorCraft contributors", "description": "Moves the colours of the selected paths towards grey; an example of the plug-in ABI.", "params": { @@ -19,6 +20,25 @@ const MANIFEST: &str = r#"{ } }"#; +/// The manifest in the `vc_manifest` custom section, where the host reads it, with its `abi` +/// version, without running any of the module's code. The `vc_manifest` export below returns the +/// same text for hosts that read only the export. +#[used] +#[unsafe(link_section = "vc_manifest")] +static MANIFEST_SECTION: [u8; MANIFEST.len()] = section_bytes(); + +/// `MANIFEST` as a byte array, which `link_section` needs. +const fn section_bytes() -> [u8; N] { + let text = MANIFEST.as_bytes(); + let mut out = [0; N]; + let mut i = 0; + while i < N { + out[i] = text[i]; + i += 1; + } + out +} + #[unsafe(no_mangle)] pub extern "C" fn vc_abi_version() -> u32 { 1 diff --git a/crates/plugins/src/manifest.rs b/crates/plugins/src/manifest.rs index b6e17e3ad0..899cdb9152 100644 --- a/crates/plugins/src/manifest.rs +++ b/crates/plugins/src/manifest.rs @@ -10,6 +10,9 @@ use crate::{Error, Result}; /// Longest manifest the host reads. pub const MAX_MANIFEST_BYTES: usize = 64 * 1024; +/// The name of the custom section a module may carry its manifest in, so the host reads it +/// without running any of the module's code. +pub const MANIFEST_SECTION: &str = "vc_manifest"; /// Most parameters a plug-in may declare. pub const MAX_PARAMS: usize = 256; /// Most parameters outside groups (`group`): a dialog of more is sorted into sections. @@ -299,7 +302,8 @@ impl ParamSpec { } } -/// The manifest a plug-in returns from `vc_manifest` (UTF-8 JSON). +/// The manifest a plug-in carries in its [`MANIFEST_SECTION`] custom section or returns from +/// `vc_manifest` (UTF-8 JSON). #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Manifest { diff --git a/crates/plugins/src/runtime.rs b/crates/plugins/src/runtime.rs index 1a25e9e6b0..853fe5def0 100644 --- a/crates/plugins/src/runtime.rs +++ b/crates/plugins/src/runtime.rs @@ -1,13 +1,13 @@ //! The wasmi host: loading, instantiating and calling a plug-in under resource limits. use wasmi::{ - Config, CustomFuelCosts, EnforcedLimits, Engine, Instance, Memory, Module, Store, StoreLimitsBuilder, TypedFunc, TypedResumableCall, Val, - WasmParams, WasmResults, + Config, CustomFuelCosts, EnforcedLimits, Engine, ExternType, Instance, Memory, Module, Store, StoreLimitsBuilder, TypedFunc, TypedResumableCall, + Val, ValType, WasmParams, WasmResults, }; use wasmparser::{Validator, WasmFeatures}; use crate::host::{self, Bridge, Deadline, Host, Report, Run}; -use crate::manifest::{MAX_MANIFEST_BYTES, Manifest}; +use crate::manifest::{MANIFEST_SECTION, MAX_MANIFEST_BYTES, Manifest}; use crate::permissions::Permission; use crate::{Error, Kind, Result}; @@ -198,10 +198,96 @@ fn wasm_err(e: wasmi::Error) -> Error { /// `vc_run(input_ptr, input_len, params_ptr, params_len) -> len << 32 | ptr` (negative: error). type RunArgs = (i32, i32, i32, i32); +/// The manifest in the module's [`MANIFEST_SECTION`] custom section, or `None` when it has none. +/// A module with more than one is refused, and so is a section longer than [`MAX_MANIFEST_BYTES`], +/// which [`Manifest::parse`] checks before it decodes the bytes. The manifest in the section must +/// give the ABI version as `abi`, in place of the `vc_abi_version` export. +fn section_manifest(module: &Module) -> Result> { + let mut sections = module.custom_sections().filter(|s| s.name() == MANIFEST_SECTION); + let Some(section) = sections.next() else { + return Ok(None); + }; + if sections.next().is_some() { + return Err(Error::Manifest(format!("the module has more than one `{MANIFEST_SECTION}` custom section"))); + } + let manifest = Manifest::parse(section.data())?; + // `Manifest::parse` has checked that the section is UTF-8 JSON of at most `MAX_MANIFEST_BYTES`. + let abi = serde_json::from_slice::(section.data()).ok().and_then(|v| v.get("abi").and_then(serde_json::Value::as_i64)); + if abi != Some(i64::from(ABI_VERSION)) { + return Err(Error::Abi(format!( + "the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements" + ))); + } + Ok(Some(manifest)) +} + +/// Most tables a module may define: the store an instance runs in holds no more. +const MAX_TABLES: u64 = 4; +/// Most elements a table may hold: the store an instance runs in holds no more. +const MAX_TABLE_ELEMENTS: u64 = 100_000; + +/// The number of tables the module in `bytes` defines and the largest initial size among them, +/// from its table section, or `None` when its sections can't be read. `bytes` is a module +/// [`check_features`] has validated. +fn table_sizes(bytes: &[u8]) -> Option<(u64, u64)> { + for payload in wasmparser::Parser::new(0).parse_all(bytes) { + if let wasmparser::Payload::TableSection(reader) = payload.ok()? { + let count = u64::from(reader.count()); + let mut largest = 0; + for table in reader { + largest = largest.max(table.ok()?.ty.initial); + } + return Some((count, largest)); + } + } + Some((0, 0)) +} + +/// Checks the tables the module in `bytes` defines against the store's limits ([`MAX_TABLES`] +/// tables of at most [`MAX_TABLE_ELEMENTS`] elements), which instantiating it checks. The host +/// offers no tables to import, so the module defines every table it has. +fn check_tables(bytes: &[u8]) -> Result<()> { + let Some((count, largest)) = table_sizes(bytes) else { + return Err(Error::Module("the module's table section could not be read".into())); + }; + if count > MAX_TABLES || largest > MAX_TABLE_ELEMENTS { + return Err(Error::Limit(format!( + "table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements)" + ))); + } + Ok(()) +} + +/// Checks the exports a run needs without instantiating `module`: its memory as `memory`, whose +/// initial size fits in `max_memory_bytes`, and `vc_alloc` and `vc_run` with the ABI's types. +fn check_exports(module: &Module, max_memory_bytes: usize) -> Result<()> { + use ValType::{I32, I64}; + let export = |name: &str| module.exports().find(|e| e.name() == name).map(|e| e.ty().clone()); + let Some(ExternType::Memory(memory)) = export("memory") else { + return Err(Error::Abi("the module must export its linear memory as `memory`".into())); + }; + // Pages are 64 KiB: the engine's configuration leaves custom page sizes off. + let initial = memory.minimum().saturating_mul(1 << 16); + if initial > max_memory_bytes as u64 { + return Err(Error::Limit(format!("memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes})"))); + } + let wanted: [(&str, &[ValType], &[ValType], &str); 2] = + [("vc_alloc", &[I32], &[I32], "(param i32) (result i32)"), ("vc_run", &[I32, I32, I32, I32], &[I64], "(param i32 i32 i32 i32) (result i64)")]; + for (name, params, results, signature) in wanted { + if !matches!(export(name), Some(ExternType::Func(f)) if f.params() == params && f.results() == results) { + return Err(Error::Abi(format!("the module must export `{name}` with the type {signature}"))); + } + } + Ok(()) +} + impl Plugin { - /// Validates and loads a module: checks the ABI version, the exports and reads the manifest, and - /// checks that each host import it asks for is one the host offers ([`crate::host::IMPORTS`]) - /// and its manifest allows. In Safe Mode nothing is loaded ([`Error::SafeMode`]). + /// Validates and loads a module: reads the manifest, checks that each host import it asks for + /// is one the host offers ([`crate::host::IMPORTS`]) and its manifest allows, and checks the + /// exports. A module that carries its manifest in a [`MANIFEST_SECTION`] custom section is + /// checked without being instantiated, so none of its code runs; one without that section is + /// instantiated to call `vc_abi_version` and `vc_manifest`. In Safe Mode nothing is loaded + /// ([`Error::SafeMode`]). pub fn load(bytes: &[u8], limits: Limits) -> Result { crate::safe_mode::check()?; if bytes.len() > limits.max_module_bytes { @@ -222,22 +308,31 @@ impl Plugin { let imports = host::check_imports(&module)?; let hash = crate::permissions::sha256_hex(bytes); let mut p = Plugin { manifest: Manifest::placeholder(), engine, module, limits, size: bytes.len(), hash, source: None, serial: 0 }; - let deadline = Deadline::new(p.limits.wall_time_ms); - // The manifest isn't read yet: every host import is linked, what it reports is dropped and - // there is no storage to reach. - let mut live = p.instantiate(Run::new("", false, false, deadline), &crate::permissions::ALL, &mut Report::default())?; - let version: TypedFunc<(), i32> = live.func("vc_abi_version")?; - let v = p.call(&mut live, &version, (), p.limits.fuel_base, &deadline)?; - if v != ABI_VERSION { - return Err(Error::Abi(format!("vc_abi_version returned {v}; this host implements version {ABI_VERSION}"))); - } - let manifest: TypedFunc<(), i64> = live.func("vc_manifest")?; - let packed = p.call(&mut live, &manifest, (), p.limits.fuel_base, &deadline)?; - let text = live.read_packed(packed, "vc_manifest", MAX_MANIFEST_BYTES).map_err(|e| match e { - Error::Limit(_) => Error::Manifest(format!("manifest is too long (limit {MAX_MANIFEST_BYTES} bytes)")), - e => e, - })?; - p.manifest = Manifest::parse(&text)?; + let live = match section_manifest(&p.module)? { + Some(manifest) => { + p.manifest = manifest; + None + } + None => { + let deadline = Deadline::new(p.limits.wall_time_ms); + // The manifest isn't read yet: every host import is linked, what it reports is + // dropped and there is no storage to reach. + let mut live = p.instantiate(Run::new("", false, false, deadline), &crate::permissions::ALL, &mut Report::default())?; + let version: TypedFunc<(), i32> = live.func("vc_abi_version")?; + let v = p.call(&mut live, &version, (), p.limits.fuel_base, &deadline)?; + if v != ABI_VERSION { + return Err(Error::Abi(format!("vc_abi_version returned {v}; this host implements version {ABI_VERSION}"))); + } + let manifest: TypedFunc<(), i64> = live.func("vc_manifest")?; + let packed = p.call(&mut live, &manifest, (), p.limits.fuel_base, &deadline)?; + let text = live.read_packed(packed, "vc_manifest", MAX_MANIFEST_BYTES).map_err(|e| match e { + Error::Limit(_) => Error::Manifest(format!("manifest is too long (limit {MAX_MANIFEST_BYTES} bytes)")), + e => e, + })?; + p.manifest = Manifest::parse(&text)?; + Some(live) + } + }; host::check_granted(&p.manifest, &imports)?; // A heavy filter's runs get the larger budget the host allows for one, which the host // lets the user allow or refuse before installing it. @@ -246,8 +341,16 @@ impl Plugin { p.limits.wall_time_ms = p.limits.wall_time_ms.max(p.limits.heavy_wall_time_ms); } // The other exports must exist with the right types. - live.func::("vc_alloc")?; - live.func::("vc_run")?; + match live { + Some(live) => { + live.func::("vc_alloc")?; + live.func::("vc_run")?; + } + None => { + check_exports(&p.module, p.limits.max_memory_bytes)?; + check_tables(bytes)?; + } + } Ok(p) } @@ -294,8 +397,13 @@ impl Plugin { /// A new instance for `run`, with the host imports of the permissions `granted` linked. When the /// module's start function fails, what it reported through the host imports goes to `report`. fn instantiate(&self, run: Run, granted: &[Permission], report: &mut Report) -> Result { - let limits = - StoreLimitsBuilder::new().memory_size(self.limits.max_memory_bytes).memories(1).tables(4).table_elements(100_000).instances(1).build(); + let limits = StoreLimitsBuilder::new() + .memory_size(self.limits.max_memory_bytes) + .memories(1) + .tables(MAX_TABLES as usize) + .table_elements(MAX_TABLE_ELEMENTS as usize) + .instances(1) + .build(); let mut store = Store::new(&self.engine, Host { limits, run }); store.limiter(|h| &mut h.limits); // The start function (if any) runs on one slice of fuel: it runs before `call` can check diff --git a/crates/plugins/src/wat.rs b/crates/plugins/src/wat.rs index 936d5d9e53..fbb93f6e51 100644 --- a/crates/plugins/src/wat.rs +++ b/crates/plugins/src/wat.rs @@ -7,12 +7,25 @@ const OUTPUT_AT: usize = 0x1_0000; /// `s` as the body of a WAT string literal (every byte that isn't a letter, digit or space /// escaped). pub fn string(s: &str) -> String { - s.bytes().map(|b| if b.is_ascii_alphanumeric() || b == b' ' { char::from(b).to_string() } else { format!("\\{b:02x}") }).collect() + bytes(s.as_bytes()) } +/// `data` as the body of a WAT string literal, every byte that isn't an ASCII letter, digit or +/// space escaped (so it may hold any bytes, UTF-8 or not). +pub fn bytes(data: &[u8]) -> String { + data.iter().map(|&b| if b.is_ascii_alphanumeric() || b == b' ' { char::from(b).to_string() } else { format!("\\{b:02x}") }).collect() +} + +/// `vc_alloc`, which grows memory by whole pages, so its blocks never overlap data segments. +const ALLOC: &str = r#"(func (export "vc_alloc") (param $n i32) (result i32) (local $old i32) + (local.set $old (memory.grow (i32.shr_u (i32.add (local.get $n) (i32.const 65535)) (i32.const 16)))) + (if (result i32) (i32.eq (local.get $old) (i32.const -1)) (then (i32.const 0)) (else (i32.mul (local.get $old) (i32.const 65536)))))"#; + /// A plug-in module: `manifest` (JSON), a `vc_run` whose body is `run` (parameters `$in $il $pp /// $pl`, result i64), extra module fields `extra` and `pages` of initial memory. `vc_alloc` grows -/// memory by whole pages, so its blocks never overlap data segments. +/// memory by whole pages, so its blocks never overlap data segments. The manifest comes from the +/// `vc_manifest` export, which the host calls when it loads the module ([`sectioned`] carries it in +/// a custom section instead). pub fn module(manifest: &str, run: &str, extra: &str, pages: u32) -> String { format!( r#"(module @@ -21,9 +34,7 @@ pub fn module(manifest: &str, run: &str, extra: &str, pages: u32) -> String { (data (i32.const 16) "{data}") (func (export "vc_abi_version") (result i32) (i32.const 1)) (func (export "vc_manifest") (result i64) (i64.or (i64.shl (i64.const {len}) (i64.const 32)) (i64.const 16))) - (func (export "vc_alloc") (param $n i32) (result i32) (local $old i32) - (local.set $old (memory.grow (i32.shr_u (i32.add (local.get $n) (i32.const 65535)) (i32.const 16)))) - (if (result i32) (i32.eq (local.get $old) (i32.const -1)) (then (i32.const 0)) (else (i32.mul (local.get $old) (i32.const 65536))))) + {ALLOC} (func (export "vc_run") (param $in i32) (param $il i32) (param $pp i32) (param $pl i32) (result i64) {run}))"#, data = string(manifest), @@ -31,6 +42,36 @@ pub fn module(manifest: &str, run: &str, extra: &str, pages: u32) -> String { ) } +/// A custom section named `name` holding `data`, as a module field. +pub fn custom_section(name: &str, data: &[u8]) -> String { + format!(r#"(@custom "{}" "{}")"#, string(name), bytes(data)) +} + +/// A plug-in module like [`module`] that carries `manifest` in its `vc_manifest` custom section +/// ([`crate::manifest::MANIFEST_SECTION`]) and exports only `memory`, `vc_alloc` and `vc_run`: the +/// host reads the manifest without running any of its code. The host loads it only when `manifest` +/// gives `"abi": 1`. +pub fn sectioned(manifest: &str, run: &str, extra: &str, pages: u32) -> String { + format!( + r#"(module + {section} + {extra} + (memory (export "memory") {pages}) + {ALLOC} + (func (export "vc_run") (param $in i32) (param $il i32) (param $pp i32) (param $pl i32) (result i64) + {run}))"#, + section = custom_section(crate::manifest::MANIFEST_SECTION, manifest.as_bytes()), + ) +} + +/// `module` (a module in WebAssembly text that starts with `(module`, after any white space) with +/// the module field `field` added first, such as a [`custom_section`]; `None` when `module` does not +/// start with `(module`. +pub fn with_field(module: &str, field: &str) -> Option { + let rest = module.trim_start().strip_prefix("(module")?; + Some(format!("(module\n {field}{rest}")) +} + /// A `vc_run` body returning the input unchanged. pub const ECHO: &str = "(i64.or (i64.shl (i64.extend_i32_u (local.get $il)) (i64.const 32)) (i64.extend_i32_u (local.get $in)))"; diff --git a/crates/plugins/tests/abi.rs b/crates/plugins/tests/abi.rs index ae99846c69..aa6c3ad2f0 100644 --- a/crates/plugins/tests/abi.rs +++ b/crates/plugins/tests/abi.rs @@ -6,6 +6,7 @@ use std::time::{Duration, Instant}; use serde_json::{Value, json}; +use vectorcraft_plugins::manifest::{MANIFEST_SECTION, MAX_MANIFEST_BYTES}; use vectorcraft_plugins::storage::{Meter, Storage, StorageError}; use vectorcraft_plugins::{Error, HEAVY_FUEL, HEAVY_WALL_TIME_MS, Kind, LARGE_FUEL, Limits, Plugin, Report, heavy_terms, registry, wat as tpl}; @@ -488,6 +489,131 @@ fn host_imports_are_checked_when_a_module_is_loaded() { assert_eq!(plain.run_reporting(INPUT.as_bytes(), b"{}", plain.limits()), (Ok(INPUT.as_bytes().to_vec()), Report::default())); } +/// A start function that traps: a load that instantiates the module fails with it. +const TRAPPING_START: &str = "(func $trap unreachable) (start $trap)"; + +/// [`MANIFEST`] with the ABI version, as a `vc_manifest` section must give it. +const SECTION: &str = r#"{"id":"test.plugin","name":"Test","version":"1","kind":"filter","abi":1}"#; + +/// `module` with a `vc_manifest` custom section holding `data`. +fn with_section(module: &str, data: &[u8]) -> String { + tpl::with_field(module, &tpl::custom_section(MANIFEST_SECTION, data)).expect("module text") +} + +/// Asserts that each case's module is refused with an error that contains its text, and lists every +/// case that is not. +fn assert_refused(cases: &[(&str, String, &str)]) { + let wrong: Vec = cases + .iter() + .filter_map(|(name, src, says)| match Plugin::load(&build(src), Limits::default()) { + Err(e) if e.to_string().contains(says) => None, + other => Some(format!("{name}: {other:?}")), + }) + .collect(); + assert!(wrong.is_empty(), "not refused as expected:\n{}", wrong.join("\n")); +} + +/// A module that carries its manifest in a `vc_manifest` custom section loads without any of its +/// code running: not its start function, not `vc_abi_version` and not `vc_manifest`. Its runs +/// instantiate it as before. +#[test] +fn a_manifest_section_is_read_without_running_the_module() { + let exports = r#"(func (export "vc_abi_version") (result i32) unreachable) + (func (export "vc_manifest") (result i64) (loop $l (br $l)) (i64.const 0))"#; + let p = Plugin::load(&build(&tpl::sectioned(SECTION, tpl::ECHO, &format!("{exports} {TRAPPING_START}"), 1)), Limits::default()).unwrap(); + assert_eq!(p.id(), "test.plugin"); + assert!(matches!(p.run(INPUT.as_bytes(), b"{}"), Err(Error::Trap(_))), "a run still runs the start function"); + let p = Plugin::load(&build(&tpl::sectioned(SECTION, tpl::ECHO, exports, 1)), Limits::default()).unwrap(); + assert_eq!(p.run(INPUT.as_bytes(), b"{}").unwrap(), INPUT.as_bytes()); +} + +/// A module with the section needs neither `vc_abi_version` nor `vc_manifest`, and when it also +/// has a `vc_manifest` export that says otherwise, the section is the manifest. +#[test] +fn the_manifest_section_needs_no_manifest_export_and_wins_over_one() { + let p = Plugin::load(&build(&tpl::sectioned(SECTION, tpl::ECHO, "", 1)), Limits::default()).unwrap(); + assert_eq!(p.run(INPUT.as_bytes(), b"{}").unwrap(), INPUT.as_bytes()); + let exported = r#"{"id":"test.exported","name":"Exported","version":"1","kind":"effect"}"#; + let p = Plugin::load(&build(&with_section(&tpl::module(exported, tpl::ECHO, "", 1), SECTION.as_bytes())), Limits::default()).unwrap(); + assert_eq!((p.id(), p.manifest().kind), ("test.plugin", Kind::Filter)); +} + +/// The section's manifest gives the ABI version as `abi`, which the host checks in place of the +/// `vc_abi_version` export: left out or another version, the module is refused, whatever its +/// export returns. +#[test] +fn a_manifest_section_must_give_the_abi_version() { + let says = "must give `abi` as 1"; + let version_1 = tpl::module(MANIFEST, tpl::ECHO, "", 1); + let version_2 = version_1.replace("(result i32) (i32.const 1)", "(result i32) (i32.const 2)"); + assert!(load_err(&build(&version_2)).contains("vc_abi_version returned 2")); + assert_refused(&[ + ("left out", with_section(&version_1, MANIFEST.as_bytes()), says), + ("2", with_section(&version_1, SECTION.replace(r#""abi":1"#, r#""abi":2"#).as_bytes()), says), + ("a string", with_section(&version_1, SECTION.replace(r#""abi":1"#, r#""abi":"1""#).as_bytes()), says), + ("a fraction", with_section(&version_1, SECTION.replace(r#""abi":1"#, r#""abi":1.5"#).as_bytes()), says), + ]); + // The section's version is the one the host checks. + let p = Plugin::load(&build(&with_section(&version_2, SECTION.as_bytes())), Limits::default()).unwrap(); + assert_eq!(p.run(INPUT.as_bytes(), b"{}").unwrap(), INPUT.as_bytes()); +} + +/// A `vc_manifest` section that is repeated, too long, not UTF-8, not JSON or not a valid manifest +/// is refused, even when the module's `vc_manifest` export returns a valid one. +#[test] +fn hostile_manifest_sections_are_refused() { + let base = tpl::module(MANIFEST, tpl::ECHO, "", 1); + let with = |data: &[u8]| with_section(&base, data); + let long = format!(r#"{{"id":"test.long","name":"Long","kind":"filter","abi":1,"description":"{}"}}"#, " ".repeat(MAX_MANIFEST_BYTES)); + for (name, src, says) in [ + ("repeated", with_section(&with(SECTION.as_bytes()), SECTION.as_bytes()), "more than one"), + ("too long", with(long.as_bytes()), "(limit "), + ("not UTF-8", with(b"{\"id\":\"\xff\xfe\"}"), "not UTF-8"), + ("not JSON", with(br#"{"id":"test.plugin","#), "manifest"), + ("empty", with(b""), "manifest"), + ("a bad id", with(br#"{"id":"a b","name":"x","kind":"filter","abi":1}"#), "invalid id"), + ("an unknown kind", with(br#"{"id":"a","name":"x","kind":"panel","abi":1}"#), "manifest"), + ] { + match Plugin::load(&build(&src), Limits::default()) { + Err(Error::Manifest(e)) => assert!(e.contains(says), "{name}: {e}"), + other => panic!("{name}: {other:?}"), + } + } +} + +/// A module with the section has its imports checked against its manifest, its exports by type, +/// and its initial memory and tables against the limits its runs have, before any of its code runs +/// (its start function would trap). +#[test] +fn a_sectioned_module_s_imports_and_exports_are_checked_before_it_runs() { + let call = r#"(import "env" "vc_call" (func (param i32 i32 i32 i32) (result i32)))"#; + let level2 = LEVEL2.replace(r#""api":2"#, r#""api":2,"abi":1"#); + let e = load_err(&build(&tpl::sectioned(&level2, tpl::ECHO, &format!("{call} {TRAPPING_START}"), 1))); + assert!(e.contains("imports `env.vc_call`") && e.contains("the permission `commands`"), "{e}"); + let sectioned = tpl::sectioned(SECTION, tpl::ECHO, TRAPPING_START, 1); + let tables = |t: &str| tpl::sectioned(SECTION, tpl::ECHO, &format!("{t} {TRAPPING_START}"), 1); + assert_refused(&[ + ("no memory", sectioned.replace(r#"(memory (export "memory") 1)"#, "(memory 1)"), "export its linear memory as `memory`"), + ( + "initial memory past the cap", + tpl::sectioned(SECTION, tpl::ECHO, TRAPPING_START, 60_000), + "exceeded its memory budget (the module's initial memory", + ), + ("no vc_alloc", sectioned.replace(r#"(export "vc_alloc")"#, ""), "must export `vc_alloc` with the type (param i32) (result i32)"), + ( + "vc_run of another type", + tpl::sectioned(SECTION, "(i32.const 0)", TRAPPING_START, 1).replace("(param $pl i32) (result i64)", "(param $pl i32) (result i32)"), + "must export `vc_run` with the type (param i32 i32 i32 i32) (result i64)", + ), + ("five tables", tables(&"(table 0 funcref) ".repeat(5)), "exceeded its table budget (the module defines 5 tables"), + ("a table too large", tables("(table 1 funcref) (table 100001 200000 externref)"), "the largest with 100001 elements"), + ]); + // At the limits, it loads and runs. + let at_limits = tpl::sectioned(SECTION, tpl::ECHO, "(table 100000 funcref) (table 0 funcref) (table 0 externref) (table 2 3 funcref)", 1); + let p = Plugin::load(&build(&at_limits), Limits::default()).unwrap(); + assert_eq!(p.run(INPUT.as_bytes(), b"{}").unwrap(), INPUT.as_bytes()); +} + /// Progress is clamped and passed on to the caller's sink as a share; the run's last report is kept. #[test] fn progress_reports_are_clamped_and_reach_the_caller() { diff --git a/crates/plugins/tests/fixtures/desaturate.wasm b/crates/plugins/tests/fixtures/desaturate.wasm index a8b4cdf072..730ec35545 100644 Binary files a/crates/plugins/tests/fixtures/desaturate.wasm and b/crates/plugins/tests/fixtures/desaturate.wasm differ diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index e4271f7926..886e9faa25 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -7716,6 +7716,12 @@ variable-list-end {0}, {1} {0} i {1} @msg parameter `{name}`: {what} paràmetre `{name}`: {what} @msg plug-in parameters must be a JSON object els paràmetres del complement han de ser un objecte JSON @msg the module must export its linear memory as `memory` el mòdul ha d’exportar la seva memòria lineal com a `memory` +@msg the module must export `{name}` with the type {signature} el mòdul ha d’exportar `{name}` amb el tipus {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section el mòdul té més d’una secció personalitzada `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) pressupost de memòria (la memòria inicial del mòdul és de {initial} bytes, límit {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements el manifest de la secció personalitzada `{MANIFEST_SECTION}` ha de donar `abi` com a {ABI_VERSION}, la versió de l’ABI que implementa aquest amfitrió +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) pressupost de taules (el mòdul defineix {count} taules, la més gran amb {largest} elements; límit {MAX_TABLES} taules de {MAX_TABLE_ELEMENTS} elements) +@msg the module's table section could not be read no s’ha pogut llegir la secció de taules del mòdul @msg the objects to change are no longer in the document els objectes que calia canviar ja no són al document @msg the runtime panicked l’entorn d’execució ha fallat @msg unexpected host trap aturada inesperada (trap) de l’amfitrió diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 488df173c3..53041434a1 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -7327,6 +7327,12 @@ axis Y Axis osa Y @msg parameter `{name}`: {what} parametr `{name}`: {what} @msg plug-in parameters must be a JSON object parametry zásuvného modulu musí být objekt JSON @msg the module must export its linear memory as `memory` modul musí exportovat svou lineární paměť jako `memory` +@msg the module must export `{name}` with the type {signature} modul musí exportovat `{name}` s typem {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section modul má více než jednu vlastní sekci `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) rozpočet paměti (počáteční paměť modulu má {initial} bajtů, limit {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements manifest ve vlastní sekci `{MANIFEST_SECTION}` musí uvádět `abi` jako {ABI_VERSION}, verzi ABI, kterou tento hostitel implementuje +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) rozpočet tabulek (modul definuje {count} tabulek, největší s {largest} prvky; limit {MAX_TABLES} tabulek po {MAX_TABLE_ELEMENTS} prvcích) +@msg the module's table section could not be read sekci tabulek modulu nelze přečíst @msg the objects to change are no longer in the document objekty ke změně už v dokumentu nejsou @msg the runtime panicked běhové prostředí havarovalo @msg unexpected host trap neočekávaná chyba (trap) hostitele diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 302ab6aa69..a34a07373d 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -557,6 +557,12 @@ liquify-list-end {0}, {1} {0} og {1} @msg parameter `{name}`: {what} parameteren `{name}`: {what} @msg plug-in parameters must be a JSON object plug-in-parametrene skal være et JSON-objekt @msg the module must export its linear memory as `memory` modulet skal eksportere sin lineære hukommelse som `memory` +@msg the module must export `{name}` with the type {signature} modulet skal eksportere `{name}` med typen {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section modulet har mere end én brugerdefineret sektion `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) hukommelsesbudget (modulets indledende hukommelse er {initial} byte, grænse {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements manifestet i den brugerdefinerede sektion `{MANIFEST_SECTION}` skal angive `abi` som {ABI_VERSION}, den ABI-version, denne vært implementerer +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) tabelbudget (modulet definerer {count} tabeller, den største med {largest} elementer; grænse {MAX_TABLES} tabeller med {MAX_TABLE_ELEMENTS} elementer) +@msg the module's table section could not be read modulets tabelsektion kunne ikke læses @msg the objects to change are no longer in the document de objekter, der skal ændres, er ikke længere i dokumentet @msg the runtime panicked runtime-miljøet gik i panik @msg unexpected host trap uventet trap i værten diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 9482345f18..a677e6d7ac 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -6910,6 +6910,12 @@ axis Y Axis Y-Achse @msg parameter `{name}`: {what} Parameter `{name}`: {what} @msg plug-in parameters must be a JSON object die Plug-in-Parameter müssen ein JSON-Objekt sein @msg the module must export its linear memory as `memory` das Modul muss seinen linearen Speicher als `memory` exportieren +@msg the module must export `{name}` with the type {signature} das Modul muss `{name}` mit dem Typ {signature} exportieren +@msg the module has more than one `{MANIFEST_SECTION}` custom section das Modul hat mehr als einen benutzerdefinierten Abschnitt `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) Speicherbudget (der Anfangsspeicher des Moduls ist {initial} Byte groß, Grenze {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements das Manifest im benutzerdefinierten Abschnitt `{MANIFEST_SECTION}` muss `abi` als {ABI_VERSION} angeben, die ABI-Version, die dieser Host unterstützt +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) Tabellenbudget (das Modul definiert {count} Tabellen, die größte mit {largest} Elementen; Grenze {MAX_TABLES} Tabellen mit je {MAX_TABLE_ELEMENTS} Elementen) +@msg the module's table section could not be read der Tabellenabschnitt des Moduls konnte nicht gelesen werden @msg the objects to change are no longer in the document die zu ändernden Objekte sind nicht mehr im Dokument @msg the runtime panicked die Laufzeitumgebung ist abgestürzt @msg unexpected host trap unerwarteter Abbruch (Trap) im Host diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 434d0cc0b8..f29a807b40 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7316,6 +7316,12 @@ axis Y Axis Άξονας Y @msg parameter `{name}`: {what} παράμετρος `{name}`: {what} @msg plug-in parameters must be a JSON object οι παράμετροι του προσθέτου πρέπει να είναι αντικείμενο JSON @msg the module must export its linear memory as `memory` η λειτουργική μονάδα πρέπει να εξάγει τη γραμμική της μνήμη ως `memory` +@msg the module must export `{name}` with the type {signature} η λειτουργική μονάδα πρέπει να εξάγει το `{name}` με τον τύπο {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section η λειτουργική μονάδα έχει περισσότερες από μία προσαρμοσμένες ενότητες `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) προϋπολογισμός μνήμης (η αρχική μνήμη της λειτουργικής μονάδας είναι {initial} byte, όριο {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements το μανιφέστο στην προσαρμοσμένη ενότητα `{MANIFEST_SECTION}` πρέπει να δίνει `abi` ίσο με {ABI_VERSION}, την έκδοση ABI που υλοποιεί αυτός ο κεντρικός υπολογιστής +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) προϋπολογισμός πινάκων (η λειτουργική μονάδα ορίζει {count} πίνακες, ο μεγαλύτερος με {largest} στοιχεία· όριο {MAX_TABLES} πίνακες των {MAX_TABLE_ELEMENTS} στοιχείων) +@msg the module's table section could not be read δεν ήταν δυνατή η ανάγνωση της ενότητας πινάκων της λειτουργικής μονάδας @msg the objects to change are no longer in the document τα αντικείμενα προς αλλαγή δεν βρίσκονται πια στο έγγραφο @msg the runtime panicked το περιβάλλον εκτέλεσης κατέρρευσε @msg unexpected host trap μη αναμενόμενη παγίδευση του κεντρικού υπολογιστή diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 3f83e928e4..483c649d33 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7302,6 +7302,12 @@ axis Y Axis Eje Y @msg parameter `{name}`: {what} parámetro `{name}`: {what} @msg plug-in parameters must be a JSON object los parámetros del plugin deben ser un objeto JSON @msg the module must export its linear memory as `memory` el módulo debe exportar su memoria lineal como `memory` +@msg the module must export `{name}` with the type {signature} el módulo debe exportar `{name}` con el tipo {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section el módulo tiene más de una sección personalizada `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) presupuesto de memoria (la memoria inicial del módulo es de {initial} bytes, límite {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements el manifiesto de la sección personalizada `{MANIFEST_SECTION}` debe dar `abi` como {ABI_VERSION}, la versión de la ABI que implementa este host +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) presupuesto de tablas (el módulo define {count} tablas, la mayor con {largest} elementos; límite {MAX_TABLES} tablas de {MAX_TABLE_ELEMENTS} elementos) +@msg the module's table section could not be read no se pudo leer la sección de tablas del módulo @msg the objects to change are no longer in the document los objetos que se iban a cambiar ya no están en el documento @msg the runtime panicked el entorno de ejecución falló @msg unexpected host trap error inesperado (trap) del host diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index a4d85b23e8..6f995c7ae8 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -7393,6 +7393,12 @@ axis Y Axis Y-akseli @msg parameter `{name}`: {what} parametri `{name}`: {what} @msg plug-in parameters must be a JSON object laajennuksen parametrien on oltava JSON-objekti @msg the module must export its linear memory as `memory` moduulin on vietävä lineaarinen muistinsa nimellä `memory` +@msg the module must export `{name}` with the type {signature} moduulin on vietävä `{name}` tyypillä {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section moduulissa on useampi kuin yksi mukautettu osio `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) muistibudjetti (moduulin alkumuisti on {initial} tavua, raja {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements mukautetun osion `{MANIFEST_SECTION}` manifestin on annettava `abi` arvona {ABI_VERSION}, ABI-versio, jonka tämä isäntä toteuttaa +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) taulukkobudjetti (moduuli määrittää {count} taulukkoa, suurin {largest} alkiolla; raja {MAX_TABLES} taulukkoa, kussakin enintään {MAX_TABLE_ELEMENTS} alkiota) +@msg the module's table section could not be read moduulin taulukko-osiota ei voitu lukea @msg the objects to change are no longer in the document muutettavia objekteja ei enää ole asiakirjassa @msg the runtime panicked suoritusympäristö kaatui @msg unexpected host trap odottamaton keskeytys (trap) isännässä diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 8f56486157..41f637e882 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7323,6 +7323,12 @@ axis Y Axis Axe Y @msg parameter `{name}`: {what} paramètre `{name}` : {what} @msg plug-in parameters must be a JSON object les paramètres du plug-in doivent être un objet JSON @msg the module must export its linear memory as `memory` le module doit exporter sa mémoire linéaire sous le nom `memory` +@msg the module must export `{name}` with the type {signature} le module doit exporter `{name}` avec le type {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section le module a plus d’une section personnalisée `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) budget mémoire (la mémoire initiale du module est de {initial} octets, limite {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements le manifeste de la section personnalisée `{MANIFEST_SECTION}` doit donner `abi` égal à {ABI_VERSION}, la version d’ABI que cet hôte implémente +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) budget de tables (le module définit {count} tables, la plus grande avec {largest} éléments, limite {MAX_TABLES} tables de {MAX_TABLE_ELEMENTS} éléments) +@msg the module's table section could not be read la section des tables du module n’a pas pu être lue @msg the objects to change are no longer in the document les objets à modifier ne sont plus dans le document @msg the runtime panicked l’environnement d’exécution a planté @msg unexpected host trap arrêt inattendu (trap) de l’hôte diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index e9509d9202..1a35ff78dc 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -9396,6 +9396,12 @@ liquify-list-end {0}, {1} {0} और {1} @msg the library holds {MAX_ITEMS} items of this kind already लाइब्रेरी पहले से ही इस तरह के {MAX_ITEMS} आइटम रखता है @msg the library item is damaged लाइब्रेरी आइटम क्षतिग्रस्त है @msg the module must export its linear memory as `memory` मॉड्यूल को अपनी रैखिक मेमोरी `memory` के रूप में एक्सपोर्ट करनी चाहिए +@msg the module must export `{name}` with the type {signature} मॉड्यूल को `{name}` को {signature} प्रकार के साथ एक्सपोर्ट करना चाहिए +@msg the module has more than one `{MANIFEST_SECTION}` custom section मॉड्यूल में एक से अधिक `{MANIFEST_SECTION}` कस्टम सेक्शन हैं +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) मेमोरी बजट (मॉड्यूल की प्रारंभिक मेमोरी {initial} बाइट है, सीमा {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements `{MANIFEST_SECTION}` कस्टम सेक्शन के मैनिफ़ेस्ट में `abi` का मान {ABI_VERSION} होना चाहिए, वह ABI संस्करण जिसे यह होस्ट लागू करता है +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) टेबल बजट (मॉड्यूल {count} टेबल परिभाषित करता है, सबसे बड़ी में {largest} एलिमेंट; सीमा {MAX_TABLES} टेबल, प्रत्येक में {MAX_TABLE_ELEMENTS} एलिमेंट) +@msg the module's table section could not be read मॉड्यूल का टेबल सेक्शन पढ़ा नहीं जा सका @msg the name is empty नाम खाली है @msg the object already has an opacity mask ऑब्जेक्ट पहले से ही एक अपारदर्शिता मास्क है @msg the object has no fill, stroke or effect ऑब्जेक्ट में कोई भराव, स्ट्रोक या इफ़ेक्ट नहीं होता है diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 87f050ef0d..678bbd1a26 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -7312,6 +7312,12 @@ axis Y Axis Y tengely @msg parameter `{name}`: {what} `{name}` paraméter: {what} @msg plug-in parameters must be a JSON object a bővítmény paraméterei JSON-objektumot alkossanak @msg the module must export its linear memory as `memory` a modulnak `memory` néven kell exportálnia a lineáris memóriáját +@msg the module must export `{name}` with the type {signature} a modulnak a(z) `{name}` elemet {signature} típussal kell exportálnia +@msg the module has more than one `{MANIFEST_SECTION}` custom section a modulnak több `{MANIFEST_SECTION}` egyéni szakasza van +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) memóriakeret (a modul kezdeti memóriája {initial} bájt, korlát {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements a(z) `{MANIFEST_SECTION}` egyéni szakasz manifesztjének az `abi` értékét {ABI_VERSION} értékként kell megadnia, amely az e gazdaprogram által megvalósított ABI-verzió +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) táblakeret (a modul {count} táblát definiál, a legnagyobb {largest} elemmel; korlát {MAX_TABLES} tábla, egyenként {MAX_TABLE_ELEMENTS} elem) +@msg the module's table section could not be read a modul táblaszakasza nem olvasható @msg the objects to change are no longer in the document a módosítandó objektumok már nincsenek a dokumentumban @msg the runtime panicked a futtatókörnyezet összeomlott @msg unexpected host trap váratlan megszakítás (trap) a gazdaprogramban diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 924d3d80b5..0bd9b6ea39 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -440,6 +440,12 @@ @msg parameter `{name}`: {what} parameter `{name}`: {what} @msg plug-in parameters must be a JSON object parameter plug-in harus berupa objek JSON @msg the module must export its linear memory as `memory` modul harus mengekspor memori liniernya sebagai `memory` +@msg the module must export `{name}` with the type {signature} modul harus mengekspor `{name}` dengan tipe {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section modul memiliki lebih dari satu bagian kustom `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) anggaran memori (memori awal modul {initial} byte, batas {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements manifes di bagian kustom `{MANIFEST_SECTION}` harus memberikan `abi` sebagai {ABI_VERSION}, versi ABI yang diterapkan host ini +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) anggaran tabel (modul mendefinisikan {count} tabel, yang terbesar dengan {largest} elemen; batas {MAX_TABLES} tabel dengan {MAX_TABLE_ELEMENTS} elemen) +@msg the module's table section could not be read bagian tabel modul tidak dapat dibaca @msg the objects to change are no longer in the document objek yang akan diubah tidak lagi ada di dokumen @msg the runtime panicked runtime mengalami panik @msg unexpected host trap trap host yang tidak terduga diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 5f47e3f117..cfa8a5ebf6 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -6949,6 +6949,12 @@ axis Y Axis Asse Y @msg parameter `{name}`: {what} parametro `{name}`: {what} @msg plug-in parameters must be a JSON object i parametri del plug-in devono essere un oggetto JSON @msg the module must export its linear memory as `memory` il modulo deve esportare la sua memoria lineare come `memory` +@msg the module must export `{name}` with the type {signature} il modulo deve esportare `{name}` con il tipo {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section il modulo ha più di una sezione personalizzata `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) budget di memoria (la memoria iniziale del modulo è di {initial} byte, limite {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements il manifesto nella sezione personalizzata `{MANIFEST_SECTION}` deve indicare `abi` come {ABI_VERSION}, la versione dell’ABI che questo host implementa +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) budget delle tabelle (il modulo definisce {count} tabelle, la più grande con {largest} elementi; limite {MAX_TABLES} tabelle da {MAX_TABLE_ELEMENTS} elementi) +@msg the module's table section could not be read impossibile leggere la sezione delle tabelle del modulo @msg the objects to change are no longer in the document gli oggetti da modificare non sono più nel documento @msg the runtime panicked l’ambiente di esecuzione si è bloccato @msg unexpected host trap interruzione imprevista (trap) dell’host diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 9a1b5f6354..a48d9f8070 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -7024,6 +7024,12 @@ axis Y Axis Y 軸 @msg parameter `{name}`: {what} パラメーター `{name}`: {what} @msg plug-in parameters must be a JSON object プラグインのパラメーターは JSON オブジェクトにしてください @msg the module must export its linear memory as `memory` モジュールは線形メモリを `memory` としてエクスポートする必要があります +@msg the module must export `{name}` with the type {signature} モジュールは `{name}` を型 {signature} でエクスポートする必要があります +@msg the module has more than one `{MANIFEST_SECTION}` custom section モジュールにカスタムセクション `{MANIFEST_SECTION}` が複数あります +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) メモリ予算 (モジュールの初期メモリは {initial} バイト、上限は {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements カスタムセクション `{MANIFEST_SECTION}` のマニフェストは `abi` に {ABI_VERSION} (このホストが実装する ABI バージョン) を指定する必要があります +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) テーブル予算 (モジュールが定義するテーブルは {count} 個、最大のものは {largest} 要素、上限はテーブル {MAX_TABLES} 個、各 {MAX_TABLE_ELEMENTS} 要素) +@msg the module's table section could not be read モジュールのテーブルセクションを読み取れませんでした @msg the objects to change are no longer in the document 変更するオブジェクトがドキュメントにもうありません @msg the runtime panicked ランタイムが異常終了しました @msg unexpected host trap ホストで予期しないトラップが発生しました diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 8eeacee621..f3a270634c 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -9429,6 +9429,12 @@ axis Y Axis Y ღერძი @msg parameter `{name}`: {what} პარამეტრი `{name}`: {what} @msg plug-in parameters must be a JSON object პლაგინის პარამეტრები JSON ობიექტი უნდა იყოს @msg the module must export its linear memory as `memory` მოდულმა თავისი წრფივი მეხსიერების ექსპორტი `memory` სახელით უნდა გააკეთოს +@msg the module must export `{name}` with the type {signature} მოდულმა `{name}`-ის ექსპორტი {signature} ტიპით უნდა გააკეთოს +@msg the module has more than one `{MANIFEST_SECTION}` custom section მოდულს ერთზე მეტი `{MANIFEST_SECTION}` მორგებული სექცია აქვს +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) მეხსიერების ბიუჯეტი (მოდულის საწყისი მეხსიერება {initial} ბაიტია, ზღვარი {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements `{MANIFEST_SECTION}` მორგებული სექციის მანიფესტში `abi` უნდა იყოს {ABI_VERSION}, ABI-ის ვერსია, რომელსაც ეს ჰოსტი ახორციელებს +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) ცხრილების ბიუჯეტი (მოდული განსაზღვრავს {count} ცხრილს, უდიდესი {largest} ელემენტით; ზღვარი {MAX_TABLES} ცხრილი, თითოეულში {MAX_TABLE_ELEMENTS} ელემენტი) +@msg the module's table section could not be read მოდულის ცხრილების სექციის წაკითხვა ვერ მოხერხდა @msg the objects to change are no longer in the document შესაცვლელი ობიექტები დოკუმენტში აღარ არის @msg the runtime panicked გაშვების გარემო ავარიულად შეჩერდა @msg unexpected host trap ჰოსტის მოულოდნელი ავარიული შეჩერება (trap) diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 57e0b8be10..6dc90dcb27 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -6921,6 +6921,12 @@ axis Y Axis Y축 @msg parameter `{name}`: {what} 매개변수 `{name}`: {what} @msg plug-in parameters must be a JSON object 플러그인 매개변수는 JSON 개체여야 합니다 @msg the module must export its linear memory as `memory` 모듈은 선형 메모리를 `memory`(으)로 내보내야 합니다 +@msg the module must export `{name}` with the type {signature} 모듈은 `{name}`을(를) {signature} 형식으로 내보내야 합니다 +@msg the module has more than one `{MANIFEST_SECTION}` custom section 모듈에 사용자 지정 섹션 `{MANIFEST_SECTION}`이(가) 둘 이상 있습니다 +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) 메모리 예산(모듈의 초기 메모리가 {initial}바이트, 한도 {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements 사용자 지정 섹션 `{MANIFEST_SECTION}`의 매니페스트는 `abi`를 {ABI_VERSION}(으)로 지정해야 합니다. 이는 이 호스트가 구현하는 ABI 버전입니다 +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) 테이블 예산(모듈이 테이블 {count}개를 정의하며 가장 큰 테이블의 요소는 {largest}개, 한도는 테이블 {MAX_TABLES}개, 각 {MAX_TABLE_ELEMENTS}개 요소) +@msg the module's table section could not be read 모듈의 테이블 섹션을 읽을 수 없습니다 @msg the objects to change are no longer in the document 변경할 개체가 더 이상 문서에 없습니다 @msg the runtime panicked 런타임이 비정상 종료되었습니다 @msg unexpected host trap 호스트에서 예기치 않은 트랩이 발생했습니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 5ed5cdc3e0..d7ebd480a1 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -404,6 +404,12 @@ liquify-list-end {0}, {1} {0} en {1} @msg parameter `{name}`: {what} parameter `{name}`: {what} @msg plug-in parameters must be a JSON object plug-in-parameters moeten een JSON-object zijn @msg the module must export its linear memory as `memory` de module moet haar lineaire geheugen exporteren als `memory` +@msg the module must export `{name}` with the type {signature} de module moet `{name}` exporteren met het type {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section de module heeft meer dan één aangepaste sectie `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) geheugenbudget (het begingeheugen van de module is {initial} bytes, limiet {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements het manifest in de aangepaste sectie `{MANIFEST_SECTION}` moet `abi` opgeven als {ABI_VERSION}, de ABI-versie die deze host implementeert +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) tabelbudget (de module definieert {count} tabellen, de grootste met {largest} elementen; limiet {MAX_TABLES} tabellen van {MAX_TABLE_ELEMENTS} elementen) +@msg the module's table section could not be read de tabelsectie van de module kon niet worden gelezen @msg the objects to change are no longer in the document de te wijzigen objecten staan niet meer in het document @msg the runtime panicked de runtime is vastgelopen @msg unexpected host trap onverwachte trap in de host diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 74029133dc..c4aec592d9 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7182,6 +7182,12 @@ axis Y Axis Oś Y @msg parameter `{name}`: {what} parametr `{name}`: {what} @msg plug-in parameters must be a JSON object parametry wtyczki muszą być obiektem JSON @msg the module must export its linear memory as `memory` moduł musi eksportować swoją pamięć liniową jako `memory` +@msg the module must export `{name}` with the type {signature} moduł musi eksportować `{name}` z typem {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section moduł ma więcej niż jedną sekcję niestandardową `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) budżet pamięci (pamięć początkowa modułu ma {initial} bajtów, limit {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements manifest w sekcji niestandardowej `{MANIFEST_SECTION}` musi podawać `abi` równe {ABI_VERSION}, czyli wersję ABI implementowaną przez ten host +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) budżet tabel (moduł definiuje {count} tabel, największa ma {largest} elementów; limit {MAX_TABLES} tabel po {MAX_TABLE_ELEMENTS} elementów) +@msg the module's table section could not be read nie można odczytać sekcji tabel modułu @msg the objects to change are no longer in the document obiektów do zmiany nie ma już w dokumencie @msg the runtime panicked środowisko uruchomieniowe uległo awarii @msg unexpected host trap nieoczekiwane przerwanie (trap) hosta diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index a1747af0b2..43df09f5cc 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -7226,6 +7226,12 @@ axis Y Axis Eixo Y @msg parameter `{name}`: {what} parâmetro `{name}`: {what} @msg plug-in parameters must be a JSON object os parâmetros do plug-in devem ser um objeto JSON @msg the module must export its linear memory as `memory` o módulo deve exportar sua memória linear como `memory` +@msg the module must export `{name}` with the type {signature} o módulo deve exportar `{name}` com o tipo {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section o módulo tem mais de uma seção personalizada `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) orçamento de memória (a memória inicial do módulo é de {initial} bytes, limite {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements o manifesto na seção personalizada `{MANIFEST_SECTION}` deve informar `abi` como {ABI_VERSION}, a versão da ABI que este host implementa +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) orçamento de tabelas (o módulo define {count} tabelas, a maior com {largest} elementos; limite {MAX_TABLES} tabelas de {MAX_TABLE_ELEMENTS} elementos) +@msg the module's table section could not be read não foi possível ler a seção de tabelas do módulo @msg the objects to change are no longer in the document os objetos a alterar não estão mais no documento @msg the runtime panicked o ambiente de execução falhou @msg unexpected host trap trap inesperada do host diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index ca0c8d5145..e28ad85a56 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -6948,6 +6948,12 @@ axis Y Axis Ось Y @msg parameter `{name}`: {what} параметр `{name}`: {what} @msg plug-in parameters must be a JSON object параметры модуля должны быть объектом JSON @msg the module must export its linear memory as `memory` модуль должен экспортировать свою линейную память как `memory` +@msg the module must export `{name}` with the type {signature} модуль должен экспортировать `{name}` с типом {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section в модуле больше одного пользовательского раздела `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) бюджет памяти (начальная память модуля составляет {initial} байт, предел {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements манифест в пользовательском разделе `{MANIFEST_SECTION}` должен указывать `abi` равным {ABI_VERSION}, версии ABI, которую реализует этот хост +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) бюджет таблиц (модуль определяет {count} таблиц, самая большая содержит {largest} элементов; предел {MAX_TABLES} таблиц по {MAX_TABLE_ELEMENTS} элементов) +@msg the module's table section could not be read не удалось прочитать раздел таблиц модуля @msg the objects to change are no longer in the document изменяемых объектов больше нет в документе @msg the runtime panicked среда выполнения аварийно завершилась @msg unexpected host trap непредвиденная ловушка (trap) хоста diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index c26474cf93..8e222d297d 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -9915,6 +9915,12 @@ digits Hindi Hindi @msg the library holds {MAX_GROUPS} groups already biblioteket innehåller redan {MAX_GROUPS} grupper @msg the library holds {MAX_ITEMS} items of this kind already biblioteket innehåller redan {MAX_ITEMS} objekt av den här typen @msg the module must export its linear memory as `memory` modulen måste exportera sitt linjära minne som `memory` +@msg the module must export `{name}` with the type {signature} modulen måste exportera `{name}` med typen {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section modulen har mer än ett anpassat avsnitt `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) minnesbudget (modulens startminne är {initial} byte, gräns {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements manifestet i det anpassade avsnittet `{MANIFEST_SECTION}` måste ange `abi` som {ABI_VERSION}, den ABI-version som den här värden implementerar +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) tabellbudget (modulen definierar {count} tabeller, den största med {largest} element; gräns {MAX_TABLES} tabeller med {MAX_TABLE_ELEMENTS} element) +@msg the module's table section could not be read modulens tabellavsnitt kunde inte läsas @msg the name is empty namnet är tomt @msg the object has no fill, stroke or effect objektet har ingen fyllning, kontur eller effekt @msg the object has no graphic style (pass `name`) objektet har ingen grafikstil (ange `name`) diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 82186ebcdd..057e511de4 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -7399,6 +7399,12 @@ axis Y Axis Y ekseni @msg parameter `{name}`: {what} `{name}` parametresi: {what} @msg plug-in parameters must be a JSON object eklenti parametreleri bir JSON nesnesi olmalıdır @msg the module must export its linear memory as `memory` modül doğrusal belleğini `memory` olarak dışa aktarmalıdır +@msg the module must export `{name}` with the type {signature} modül `{name}` öğesini {signature} türüyle dışa aktarmalıdır +@msg the module has more than one `{MANIFEST_SECTION}` custom section modülde birden fazla `{MANIFEST_SECTION}` özel bölümü var +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) bellek bütçesi (modülün başlangıç belleği {initial} bayt, sınır {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements `{MANIFEST_SECTION}` özel bölümündeki bildirim `abi` değerini {ABI_VERSION} olarak vermelidir; bu, bu ana bilgisayarın uyguladığı ABI sürümüdür +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) tablo bütçesi (modül {count} tablo tanımlıyor, en büyüğünde {largest} öğe var; sınır {MAX_TABLES} tablo, her biri {MAX_TABLE_ELEMENTS} öğe) +@msg the module's table section could not be read modülün tablo bölümü okunamadı @msg the objects to change are no longer in the document değiştirilecek nesneler artık belgede değil @msg the runtime panicked çalışma zamanı çöktü @msg unexpected host trap ana bilgisayarda beklenmeyen kesme (trap) diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index de3329ef10..45c174b28f 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -6931,6 +6931,12 @@ axis Y Axis Вісь Y @msg parameter `{name}`: {what} параметр `{name}`: {what} @msg plug-in parameters must be a JSON object параметри модуля мають бути об’єктом JSON @msg the module must export its linear memory as `memory` модуль має експортувати свою лінійну пам’ять як `memory` +@msg the module must export `{name}` with the type {signature} модуль має експортувати `{name}` з типом {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section модуль має більше ніж один користувацький розділ `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) бюджет пам’яті (початкова пам’ять модуля становить {initial} байтів, межа {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements маніфест у користувацькому розділі `{MANIFEST_SECTION}` має вказувати `abi` як {ABI_VERSION}, версію ABI, яку реалізує цей хост +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) бюджет таблиць (модуль визначає {count} таблиць, найбільша містить {largest} елементів; межа {MAX_TABLES} таблиць по {MAX_TABLE_ELEMENTS} елементів) +@msg the module's table section could not be read не вдалося прочитати розділ таблиць модуля @msg the objects to change are no longer in the document об’єктів, які треба змінити, більше немає в документі @msg the runtime panicked середовище виконання аварійно завершилося @msg unexpected host trap неочікувана пастка (trap) хоста diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 675143a8d6..45a7a60dcb 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -6977,6 +6977,12 @@ axis Y Axis Trục Y @msg parameter `{name}`: {what} tham số `{name}`: {what} @msg plug-in parameters must be a JSON object tham số plug-in phải là một đối tượng JSON @msg the module must export its linear memory as `memory` mô-đun phải export bộ nhớ tuyến tính của nó dưới tên `memory` +@msg the module must export `{name}` with the type {signature} mô-đun phải export `{name}` với kiểu {signature} +@msg the module has more than one `{MANIFEST_SECTION}` custom section mô-đun có nhiều hơn một phần tùy chỉnh `{MANIFEST_SECTION}` +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) ngân sách bộ nhớ (bộ nhớ ban đầu của mô-đun là {initial} byte, giới hạn {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements tệp kê khai trong phần tùy chỉnh `{MANIFEST_SECTION}` phải đặt `abi` là {ABI_VERSION}, phiên bản ABI mà máy chủ này triển khai +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) ngân sách bảng (mô-đun định nghĩa {count} bảng, bảng lớn nhất có {largest} phần tử; giới hạn {MAX_TABLES} bảng, mỗi bảng {MAX_TABLE_ELEMENTS} phần tử) +@msg the module's table section could not be read không thể đọc phần bảng của mô-đun @msg the objects to change are no longer in the document các đối tượng cần thay đổi không còn trong tài liệu @msg the runtime panicked môi trường chạy bị lỗi nghiêm trọng @msg unexpected host trap máy chủ gặp trap không mong muốn diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 57f6a4403b..a08ba584c2 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7159,6 +7159,12 @@ axis Y Axis Y 轴 @msg parameter `{name}`: {what} 参数 `{name}`:{what} @msg plug-in parameters must be a JSON object 增效工具参数必须是 JSON 对象 @msg the module must export its linear memory as `memory` 模块必须将其线性内存导出为 `memory` +@msg the module must export `{name}` with the type {signature} 模块必须以类型 {signature} 导出 `{name}` +@msg the module has more than one `{MANIFEST_SECTION}` custom section 模块有多个 `{MANIFEST_SECTION}` 自定义段 +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) 内存预算(模块的初始内存为 {initial} 字节,上限 {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements `{MANIFEST_SECTION}` 自定义段中的清单必须将 `abi` 设为 {ABI_VERSION},即此宿主实现的 ABI 版本 +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) 表预算(模块定义了 {count} 个表,最大的有 {largest} 个元素;上限为 {MAX_TABLES} 个表,每个 {MAX_TABLE_ELEMENTS} 个元素) +@msg the module's table section could not be read 无法读取模块的表段 @msg the objects to change are no longer in the document 要更改的对象已不在文档中 @msg the runtime panicked 运行时崩溃 @msg unexpected host trap 宿主发生意外的 trap diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 9834c17ea6..97aa5a98a9 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -6980,6 +6980,12 @@ axis Y Axis Y 軸 @msg parameter `{name}`: {what} 參數 `{name}`:{what} @msg plug-in parameters must be a JSON object 增效模組參數必須是 JSON 物件 @msg the module must export its linear memory as `memory` 模組必須將其線性記憶體匯出為 `memory` +@msg the module must export `{name}` with the type {signature} 模組必須以類型 {signature} 匯出 `{name}` +@msg the module has more than one `{MANIFEST_SECTION}` custom section 模組有多個 `{MANIFEST_SECTION}` 自訂區段 +@msg memory budget (the module's initial memory is {initial} bytes, limit {max_memory_bytes}) 記憶體預算(模組的初始記憶體為 {initial} 位元組,上限 {max_memory_bytes}) +@msg the manifest in the `{MANIFEST_SECTION}` custom section must give `abi` as {ABI_VERSION}, the ABI version this host implements `{MANIFEST_SECTION}` 自訂區段中的資訊清單必須將 `abi` 設為 {ABI_VERSION},即此主機實作的 ABI 版本 +@msg table budget (the module defines {count} tables, the largest with {largest} elements; limit {MAX_TABLES} tables of {MAX_TABLE_ELEMENTS} elements) 表格預算(模組定義了 {count} 個表格,最大的有 {largest} 個元素;上限為 {MAX_TABLES} 個表格,每個 {MAX_TABLE_ELEMENTS} 個元素) +@msg the module's table section could not be read 無法讀取模組的表格區段 @msg the objects to change are no longer in the document 要變更的物件已不在文件中 @msg the runtime panicked 執行階段當機 @msg unexpected host trap 主機發生非預期的 trap diff --git a/docs/plugins.md b/docs/plugins.md index 7e6dd26185..04418f5552 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -367,11 +367,31 @@ pointers are offsets into the module's memory. | Export | Signature | Meaning | |---|---|---| | `memory` | memory | The module's linear memory. | -| `vc_abi_version` | `() -> i32` | Must return `1`. | -| `vc_manifest` | `() -> i64` | `(len << 32) \| ptr` of the UTF-8 manifest JSON (≤ 64 KiB). | +| `vc_abi_version` | `() -> i32` | Must return `1`. Needed only by a module without a `vc_manifest` custom section. | +| `vc_manifest` | `() -> i64` | `(len << 32) \| ptr` of the UTF-8 manifest JSON (≤ 64 KiB). Needed only by a module without a `vc_manifest` custom section. | | `vc_alloc` | `(size) -> ptr` | A block of `size` bytes the host may write, or `0` on failure. Never freed: each run gets a fresh instance. | | `vc_run` | `(input, input_len, params, params_len) -> i64` | Runs the plug-in on the input JSON with the parameters JSON; returns `(len << 32) \| ptr` of the output JSON, or a negative error code. | +### Manifest section + +A module may carry its [manifest](#manifest) in a [custom +section](https://webassembly.github.io/spec/core/binary/modules.html#custom-section) named `vc_manifest`, holding the +same UTF-8 JSON that the `vc_manifest` export returns, plus `"abi": 1`, the ABI version that `vc_abi_version` returns. +The host then reads the manifest from the section and loads the module without instantiating it: no start function, +`vc_abi_version`, `vc_manifest` or data segment initialization runs when the module is installed, inspected or loaded at +startup. The host checks the imports against the manifest's permissions, the exports `memory`, `vc_alloc` and `vc_run` +by their types, that the initial memory fits in the [linear memory limit](#the-sandbox), and that the module defines at +most 4 tables of at most 100,000 elements each. The module is instantiated for the first time when it runs, and a start +function then runs at the start of each run. + +- A module with more than one `vc_manifest` section, or one longer than 64 KiB, is refused before the section's contents + are decoded. A section that is not UTF-8, not JSON or not a valid manifest is refused too, and so is one whose + manifest does not give `"abi": 1`. +- When a module has both the section and a `vc_manifest` export, the section is the manifest and the export is never + called. Keep both to load in versions of VectorCraft that read only the export. +- A module without the section is loaded as before: the host instantiates it and calls `vc_abi_version` and + `vc_manifest`. + ### Host imports (API level 2) A plug-in whose manifest gives `"api": 2` and lists the [permission](#permissions) an import needs may import these @@ -860,10 +880,15 @@ crates/plugins/example/build.sh # cargo build --release --target wasm32-unk ``` The script also refreshes `crates/plugins/tests/fixtures/desaturate.wasm`, the test fixture built from that source. -The crate is not a workspace member. Any language that targets core WebAssembly works (C, Zig, AssemblyScript, +The crate is not a workspace member. It puts its manifest in the [manifest section](#manifest-section) with a byte +array static marked `#[unsafe(link_section = "vc_manifest")]` (the Rust Reference's +[`link_section`](https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute)), and keeps the +`vc_manifest` export for older hosts. Any language that targets core WebAssembly works (C, Zig, AssemblyScript, WAT…), as long as the module imports nothing but the host imports: in Rust, `std` on `wasm32-unknown-unknown` is fine as long as it never touches WASI. `vectorcraft_plugins::wat::module` is the skeleton of a plug-in in WebAssembly text, -which the tests build their plug-ins from; `wat::echo_exporter` is an exporter whose file is its input or its parameters +which the tests build their plug-ins from, and `wat::sectioned` the same plug-in with its manifest in the [manifest +section](#manifest-section) and no `vc_abi_version` or `vc_manifest` export (in WebAssembly text, a custom section is +written `(@custom "vc_manifest" "…")`); `wat::echo_exporter` is an exporter whose file is its input or its parameters (with a base64 encoder written out in WebAssembly text), which the tests read back what the host hands a plug-in with, and `wat::when_given` a plug-in whose output depends on whether its input or parameters hold a given text, which shows in a live effect's geometry. `wat::reporting` and `wat::cooperating` build level 2 plug-ins that import the host diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index f8a3dc84a0..f79103b179 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2655,6 +2655,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **A dialog's OK runs what it was opened for:** `ui.dialog.set`, and MCP's `answer_dialog` through it, can set a `__` field only when it is a control of that kind of dialog (a section or tab shown, a link between two fields, a name or search being typed). Every other `__` field, such as the `__command` and `__params` of a confirmation or the generic parameter dialog, a plug-in command dialog's `__command` and `__plugin`, or the paste a swatch conflict waits to finish, is refused with "the `` dialog cannot set protected field ``"; the request sets no field, and with `action: "confirm"` OK does not run. Regressions: `crates/ui-egui/src/tests/automation.rs`, `crates/ui-egui/src/control/tests.rs`. Scores and hours unchanged. - **Only an approval records a plug-in grant (G17):** `vectorcraft_plugins::registry::grant` takes a `GrantToken`, which the engine makes after an approval and when it loads `grants.json`, and `registry::install`, `install_bytes` and folder loads refuse a module that lists permissions no recorded grant gives this very module (`Error::NeedsApproval`), leaving the plug-in under its id and the revision as they were. A module without `permissions`, or with an empty list, installs as before. `docs/plugins.md` says what the approval does not protect against (native code linked into the app, another program running as the same user, the unsigned `grants.json`). Regressions: `crates/plugins/src/registry.rs`, `crates/plugins/tests/grant_sites.rs`, `crates/engine/src/tests/plugins.rs`. Scores and hours unchanged. - **A refused plug-in install writes nothing (G17):** `plugin.install` checks the plug-in installed under the module's id and its grant again while it records the grant and installs the module (`registry::install_checked`), and only then writes the module and its grant to the `Plug-ins` folder, attaches its settings and cache and turns a disabled plug-in on. When another session installed a plug-in with the id that would need `replace: true`, or changed the grant the checks relied on, the install is refused and the folder, `grants.json`, the disabled list and the installed plug-in stay as they were. Without a plug-in store, the approval comes from the grant the install checks again. A `plugin.remove`, or a load of the folder or of a plug-ins folder, in another session waits until the install has written the folder. VectorCraft's own rule. Regressions: `crates/engine/src/tests/plugins.rs`. Scores and hours unchanged. +- **A plug-in's manifest from a custom section (G17):** a module that carries its manifest in a `vc_manifest` custom section, with `"abi": 1`, is inspected, installed and loaded at startup without being instantiated, so none of its code runs (its start function, data segments, `vc_abi_version` and `vc_manifest`); the host checks its imports against the manifest's permissions, its `memory`, `vc_alloc` and `vc_run` exports by type, and its initial memory and tables against the limits its runs have. A repeated section, one over 64 KiB, or one that is not a valid manifest or gives another `abi` is refused. Such a module whose start function traps installs and fails at each run. Modules without the section load as before. The example plug-in carries the section. Regressions: `crates/plugins/tests/abi.rs`, `crates/engine/src/tests/plugins.rs`, `crates/engine/tests/plugin_fuzz.rs`. Scores and hours unchanged. - **Windows and processes take turns on the Plug-ins folder:** each one locks `disabled.lock` in the `Plug-ins` folder while it reads and changes the stored modules, `grants.json`, `disabled.json` and the plug-ins' settings and caches, so two installs of one id keep each module with its own grant, and grants or settings written by two processes are all kept. When the file can't be locked, `plugin.install` and `plugin.remove` fail and change nothing. VectorCraft's own rule. Regressions: `crates/engine/src/tests/plugins.rs`. Scores and hours unchanged. - **Plug-in approval waits before OK (G17):** the approval dialog's OK stays disabled until its question has been on screen in the focused window for half a second, VectorCraft's own value; a click, Enter, Space, or a press begun before then installs nothing, and the dialog stays open. The wait starts over for every new question, even one that reads the same, and when the window gets the focus back, so a question swapped in just before a click is not approved by it. Cancel works at once. Regressions: `crates/ui-egui/src/tests/plugins.rs`. Scores and hours unchanged. - **An install automation asked for needs the person to start it (G17):** an approval question that a control request, MCP, injected input or a file dialog one of them opened leads to keeps OK disabled and refuses every confirm, a person's click included; it says to choose Object › Plug-ins › Install Plug-in…, and `ui.installPlugin` answers `approval: "personMustStartInstall"`. The person's own Install Plug-in…, File › Open or drop inspects the module again and asks a new question. Automation's `replace: true` no longer skips the question about taking another module's place, and that question now opens in the approval dialog for everyone. VectorCraft's own rule. Regressions: `crates/ui-egui/src/tests/automation.rs`, `crates/ui-egui/src/tests/plugins.rs`. Scores and hours unchanged.