librustzcash icon indicating copy to clipboard operation
librustzcash copied to clipboard

Add panic = 'abort' to all profiles (not just release) to avoid undefined behaviour

Open daira opened this issue 5 years ago • 2 comments

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.

daira avatar May 05 '19 06:05 daira

@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

daira avatar May 05 '19 08:05 daira

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.

daira avatar May 06 '19 16:05 daira