From f5896ef4236654aae79331434aca928f5ccd5ad8 Mon Sep 17 00:00:00 2001 From: Ramon Fried Date: Tue, 23 Jul 2019 03:40:01 +0300 Subject: [PATCH] fix buf where bit position was out of bounds after reducing width --- src/interactive.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/interactive.c b/src/interactive.c index 5b0930b..fe43a2a 100644 --- a/src/interactive.c +++ b/src/interactive.c @@ -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 '*': @@ -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();