On Thu, Mar 23, 2023 at 05:58:50PM +0100, Pablo Neira Ayuso wrote: > @@ -1326,13 +1326,32 @@ static int expr_evaluate_shift(struct eval_ctx *ctx, struct expr **expr) > static int expr_evaluate_bitwise(struct eval_ctx *ctx, struct expr **expr) > { > struct expr *op = *expr, *left = op->left; > + const struct datatype *dtype; > + unsigned int max_len; > + int byteorder; > + > + if (ctx->stmt_len > left->len) { > + max_len = ctx->stmt_len; > + byteorder = BYTEORDER_HOST_ENDIAN; > + dtype = &integer_type; > + > + /* Both sides need to be in host byte order */ > + if (byteorder_conversion(ctx, &op->left, BYTEORDER_HOST_ENDIAN) < 0) > + return -1; > + > + left = op->left; > + } else { > + max_len = left->len; > + byteorder = left->byteorder; > + dtype = left->dtype; > + } > > - if (byteorder_conversion(ctx, &op->right, left->byteorder) < 0) > + if (byteorder_conversion(ctx, &op->right, byteorder) < 0) > return -1; > > - op->dtype = left->dtype; > - op->byteorder = left->byteorder; > - op->len = left->len; > + op->dtype = dtype; As in patch 5, this now uses too: datatype_set(op, dtype); > + op->byteorder = byteorder; > + op->len = max_len; > > if (expr_is_constant(left)) > return constant_binop_simplify(ctx, expr); > -- > 2.30.2 >