Skip to content

Commit 5cb6f88

Browse files
authored
Fix Wasm signature verification on big-endian platforms. (#241)
Signed-off-by: Piotr Sikora <[email protected]>
1 parent b402508 commit 5cb6f88

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

.github/workflows/cpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ jobs:
109109
repo: 'com_github_bytecodealliance_wasmtime'
110110
os: ubuntu-20.04
111111
arch: s390x
112-
action: build
112+
action: test
113113
run_under: docker run --rm --env HOME=$HOME --env USER=$(id -un) --volume "$HOME:$HOME" --workdir $(pwd) --user $(id -u):$(id -g) --platform linux/s390x piotrsikora/build-tools:bazel-5.0.0-clang-13-gcc-11
114114
- name: 'Wasmtime on macOS/x86_64'
115115
runtime: 'wasmtime'

src/signature_util.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ bool SignatureUtil::verifySignature(std::string_view bytecode, std::string &mess
8585

8686
uint32_t alg_id;
8787
std::memcpy(&alg_id, payload.data(), sizeof(uint32_t));
88+
alg_id = le32toh(alg_id);
8889

8990
if (alg_id != 2) {
9091
message = "Signature has a wrong alg_id (want: 2, is: " + std::to_string(alg_id) + ")";

0 commit comments

Comments
 (0)