librustzcash
librustzcash copied to clipboard
Add panic = 'abort' to all profiles (not just release) to avoid undefined behaviour
See https://trac.torproject.org/projects/tor/ticket/27199 , and the upstream Rust bug https://github.com/rust-lang/rust/issues/52652 (in particular my comment here).
We currently do set panic = 'abort'
in the release profile of librustzcash, which is why this is not a security bug (I believe) for current Zcash as built by default. I think (but I could be wrong) that to avoid the undefined behaviour, it only needs to be set for the crate that is directly being called by the FFI. We may want to set it for other crates under the librustzcash project anyway.
@ebfull wrote:
there isn’t a per-crate way to enable this. the top level crate defines this kind of stuff for everything being compiled
OK, so just librustzcash then. We should add a call in librustzcash that just panics, and have a gtest in zcashd that calls it and tests that the process aborts.