Skip to content

Commit

Permalink
fix buf where bit position was out of bounds after reducing width
Browse files Browse the repository at this point in the history
  • Loading branch information
mellowcandle committed Jul 23, 2019
1 parent 7ee23f5 commit f5896ef
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/interactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,16 +618,22 @@ int start_interactive(uint64_t start)
case '!':
unpaint_screen();
set_fields_width(8);
if (bit_pos > 7)
bit_pos = 7;
paint_screen();
break;
case '@':
unpaint_screen();
set_fields_width(16);
if (bit_pos > 15)
bit_pos = 15;
paint_screen();
break;
case '$':
unpaint_screen();
set_fields_width(32);
if (bit_pos > 31)
bit_pos = 31;
paint_screen();
break;
case '*':
Expand Down Expand Up @@ -675,6 +681,12 @@ int start_interactive(uint64_t start)
else if (active_win == FIELDS_WIN)
process_fields(ch);
}

if (active_win == BINARY_WIN) {
LOG("Bit pos = %u\n", bit_pos);
position_binary_curser(0, bit_pos);
}

}

unpaint_screen();
Expand Down

0 comments on commit f5896ef

Please sign in to comment.