Merge pull request #374 from ethereum/rust-host-safety

rust: add assertion for evmc_context.host
This commit is contained in:
Alex Beregszaszi 2019-07-25 14:56:11 +01:00 committed by GitHub
commit c117256e16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,6 +173,7 @@ impl ExecutionMessage {
impl<'a> ExecutionContext<'a> {
pub fn new(_context: &'a mut ffi::evmc_context) -> Self {
assert!(_context.host != std::ptr::null());
let _tx_context = unsafe {
assert!((*(_context.host)).get_tx_context.is_some());
(*(_context.host)).get_tx_context.unwrap()(_context as *mut ffi::evmc_context)