diff --git a/app/src/parser/operation_parser.c b/app/src/parser/operation_parser.c index 91c7d72f8..185812cca 100644 --- a/app/src/parser/operation_parser.c +++ b/app/src/parser/operation_parser.c @@ -415,7 +415,7 @@ tz_step_size(tz_parser_state *state) tz_raise(TOO_LARGE); // enforce 16-bit restriction op->frame->step_size.size = op->frame->step_size.size << 8 | b; op->frame->step_size.size_len--; - if (op->frame->step_size.size_len <= 0) { + if (op->frame->step_size.size_len == 0) { op->frame[-1].stop = state->ofs + op->frame->step_size.size; tz_must(pop_frame(state)); } @@ -576,7 +576,7 @@ tz_step_read_int32(tz_parser_state *state) ASSERT_STEP(state, READ_INT32); tz_operation_state *op = &state->operation; uint8_t b; - uint32_t *value = &op->frame->step_read_int32.value; + int32_t *value = &op->frame->step_read_int32.value; if (op->frame->step_read_int32.ofs < 4) { tz_must(tz_parser_read(state, &b)); *value = *value << 8 | b; diff --git a/app/src/parser/operation_state.h b/app/src/parser/operation_state.h index a9ec5efa8..a8678675e 100644 --- a/app/src/parser/operation_state.h +++ b/app/src/parser/operation_state.h @@ -147,7 +147,7 @@ typedef struct { uint8_t skip : 1, natural : 1; } step_read_num; struct { - uint32_t value; + int32_t value; uint8_t skip : 1, ofs : 3; } step_read_int32; struct {