From 80687d470cb426043d86a302c7ceda7f4e84911d Mon Sep 17 00:00:00 2001 From: NikVolf Date: Thu, 27 Apr 2017 12:36:40 +0300 Subject: [PATCH] fix with indirect calls for gas injector --- gas/Cargo.lock | 8 ++++---- gas/src/main.rs | 10 +++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gas/Cargo.lock b/gas/Cargo.lock index 30d6c9c..a1c2dd1 100644 --- a/gas/Cargo.lock +++ b/gas/Cargo.lock @@ -2,7 +2,7 @@ name = "wasm-gas" version = "0.1.0" dependencies = [ - "parity-wasm 0.3.0 (git+https://github.com/nikvolf/parity-wasm)", + "parity-wasm 0.3.2 (git+https://github.com/nikvolf/parity-wasm)", ] [[package]] @@ -12,12 +12,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "parity-wasm" -version = "0.3.0" -source = "git+https://github.com/nikvolf/parity-wasm#afb5b8d523227445d648deaee6ca6c9448d24a73" +version = "0.3.2" +source = "git+https://github.com/nikvolf/parity-wasm#b11f34f2e5410d0773dcf32699d767d7359e4ca9" dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] "checksum byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c40977b0ee6b9885c9013cd41d9feffdd22deb3bb4dc3a71d901cc7a77de18c8" -"checksum parity-wasm 0.3.0 (git+https://github.com/nikvolf/parity-wasm)" = "" +"checksum parity-wasm 0.3.2 (git+https://github.com/nikvolf/parity-wasm)" = "" diff --git a/gas/src/main.rs b/gas/src/main.rs index 08a0f2e..b6eba3a 100644 --- a/gas/src/main.rs +++ b/gas/src/main.rs @@ -94,7 +94,15 @@ fn main() { _ => {} } } - } + }, + &mut elements::Section::Element(ref mut elements_section) => { + for ref mut segment in elements_section.entries_mut() { + // update all indirect call addresses initial values + for func_index in segment.members_mut() { + if *func_index >= gas_func { *func_index += 1} + } + } + }, _ => { } } }