Fork us on GitHub Follow us on Facebook Follow us on Twitter

Opened 5 weeks ago

#838 new defect

tinput hits assertion failure if prompt runs off the screen

Reported by: Jiri Svoboda Owned by:
Priority: major Milestone:
Component: helenos/unspecified Version: mainline
Keywords: Cc:
Blocker for: Depends on:
See also:


tinput_read[_i]() will hit an assertion failure if we call it while the cursor is within str_length(prompt) characters from the end of the screen.

tinput_display() performs the following calculation, using current cursor coordinates col0, row0:

ti->prompt_coord = row0 * ti->con_cols + col0;
ti->text_coord = ti->prompt_coord + str_length(ti->prompt);

where ti→text_coord will be ≥ cols*rows and then in tinput_console_set_lpos():

       unsigned col = LIN_TO_COL(ti, lpos);
       unsigned row = LIN_TO_ROW(ti, lpos);
        assert(col < ti->con_cols);
        assert(row < ti->con_rows);

here we will have row ≥ ti→con_rows and hence the assert will fail.

An example of how to reproduce this is to create a program that purposefully puts the cursor to the bottom-right corner of the screen and then exists - at which point bdsh will try to print the prompt and it will abort.

Change History (0)

Note: See TracTickets for help on using tickets.