Nice article, thanks for putting this out there! The bare-bones example helped me do a quick sanity check whilst developing my own native messaging host in Rust.
However, there is currently a problem with the code in write_output as it exists on Github at the time of posting this comment:
let len = msg.len();
if len > 1024 * 1024 {
panic!("Message was too large, length: {}", len)
}
outstream.write(&len.to_ne_bytes())?;
This breaks the native messaging protocol when compiling on a 64-bit platform, because len is of type usize, which will be 8 bytes in length. The protocol expects only a 4 byte header denoting the message size. This is fixed easily enough with:
let len = msg.len() as u32;
Thanks again!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice article, thanks for putting this out there! The bare-bones example helped me do a quick sanity check whilst developing my own native messaging host in Rust.
However, there is currently a problem with the code in write_output as it exists on Github at the time of posting this comment:
let len = msg.len();if len > 1024 * 1024 {
panic!("Message was too large, length: {}", len)
}
outstream.write(&len.to_ne_bytes())?;
This breaks the native messaging protocol when compiling on a 64-bit platform, because len is of type usize, which will be 8 bytes in length. The protocol expects only a 4 byte header denoting the message size. This is fixed easily enough with:
let len = msg.len() as u32;Thanks again!