Skip to content

Commit

Permalink
Fix unsigned int treated as int.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajinkyaraj-23 committed Feb 14, 2024
1 parent 44f62ff commit a00fe3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/src/parser/operation_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ tz_step_size(tz_parser_state *state)
}
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));
}
Expand Down Expand Up @@ -590,7 +590,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;
Expand Down
4 changes: 2 additions & 2 deletions app/src/parser/operation_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ typedef struct {
uint8_t skip : 1, natural : 1;
} step_read_num;
struct {
uint32_t value;
uint8_t skip : 1, ofs : 3;
int32_t value;
uint8_t skip : 1, ofs : 3;
} step_read_int32;
struct {
uint16_t ofs;
Expand Down

0 comments on commit a00fe3a

Please sign in to comment.