summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2020-12-17 18:19:18 +0100
committerPhil Sutter <phil@nwl.cc>2021-11-30 14:57:46 +0100
commit15c39ac1f6924e51f0715de4266a5f1a3b9f31fc (patch)
tree827af00a077c454dba26b975760b655e29b2fcce
parent7cd0c8b3b8dd4251edd8a571c4d753a26b1c27e0 (diff)
src: Fix payload statement mask on Big Endian
The mask used to select bits to keep must be exported in the same byteorder as the payload statement itself, also the length of the exported data must match the number of bytes extracted earlier. Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r--src/evaluate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/evaluate.c b/src/evaluate.c
index eebd9921..49fb8f84 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -2556,9 +2556,9 @@ static int stmt_evaluate_payload(struct eval_ctx *ctx, struct stmt *stmt)
mpz_clear(ff);
assert(sizeof(data) * BITS_PER_BYTE >= masklen);
- mpz_export_data(data, bitmask, BYTEORDER_HOST_ENDIAN, sizeof(data));
+ mpz_export_data(data, bitmask, payload->byteorder, payload_byte_size);
mask = constant_expr_alloc(&payload->location, expr_basetype(payload),
- BYTEORDER_HOST_ENDIAN, masklen, data);
+ payload->byteorder, masklen, data);
mpz_clear(bitmask);
payload_bytes = payload_expr_alloc(&payload->location, NULL, 0);