From 8403958e3d93beae8596fa8917c563d1a7ea8ce1 Mon Sep 17 00:00:00 2001 From: TimothyBanks Date: Fri, 17 Jul 2026 09:39:38 -0400 Subject: [PATCH] feat: Wasm Module Versioning --- src/libxrpl/tx/wasm/WasmiVM.cpp | 5 +++++ src/test/app/Wasm_test.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libxrpl/tx/wasm/WasmiVM.cpp b/src/libxrpl/tx/wasm/WasmiVM.cpp index 93dab303c1..8d54895fbd 100644 --- a/src/libxrpl/tx/wasm/WasmiVM.cpp +++ b/src/libxrpl/tx/wasm/WasmiVM.cpp @@ -830,6 +830,11 @@ readLEB128(Bytes const& wasmCode, size_t& offset) shift += 7; if (shift >= 32) { + // Drain the rest of the bytes for this leb. + while (offset < wasmCode.size() && (wasmCode[offset] & 0x80) != 0) + { + ++offset; + } break; } } diff --git a/src/test/app/Wasm_test.cpp b/src/test/app/Wasm_test.cpp index 8cf99fb735..58aa40d5c2 100644 --- a/src/test/app/Wasm_test.cpp +++ b/src/test/app/Wasm_test.cpp @@ -249,7 +249,7 @@ struct Wasm_test : public beast::unit_test::Suite auto imports = ImportVec{}; WasmImpFunc(imports, "func-add", reinterpret_cast(&add), &hfs); - auto _ = vm.run(kWasmModule, hfs, 10'000'000, "finish", wasmParams(1234), imports, journal); + auto _ = vm.run(kWasmModule, hfs, 10'000'000, "finish", wasmParams(), imports, journal); auto const logged = sink.messages().str(); BEAST_EXPECT(logged.find("Module version: xrpl-escrow-stdlib 4.5.6") != std::string::npos);