diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-08-26 13:48:40 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-08-26 07:48:40 -0400 |
commit | 017f88ee99b0fe40221e6af92e0b6a976fbaf2ad (patch) | |
tree | ca7b018715aca4bb7b8a71d48a2a915e63ae5b74 /cli/ops/dispatch_json.rs | |
parent | 2235dd795d3cc6c24ff1bdd1bbdcd110b4b0bdfc (diff) |
fix: shared queue requires aligned buffer (#2816)
Diffstat (limited to 'cli/ops/dispatch_json.rs')
-rw-r--r-- | cli/ops/dispatch_json.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cli/ops/dispatch_json.rs b/cli/ops/dispatch_json.rs index a575aedb3..77d76f39f 100644 --- a/cli/ops/dispatch_json.rs +++ b/cli/ops/dispatch_json.rs @@ -37,7 +37,10 @@ fn serialize_result( Ok(v) => json!({ "ok": v, "promiseId": promise_id }), Err(err) => json!({ "err": json_err(err), "promiseId": promise_id }), }; - let vec = serde_json::to_vec(&value).unwrap(); + let mut vec = serde_json::to_vec(&value).unwrap(); + debug!("JSON response pre-align, len={}", vec.len()); + // Align to 32bit word, padding with the space character. + vec.resize((vec.len() + 3usize) & !3usize, b' '); vec.into_boxed_slice() } |