Skip to content

Commit

Permalink
* ui_screen.c: convert_char_index_to_x() never returns minus value.
Browse files Browse the repository at this point in the history
  • Loading branch information
arakiken committed Jul 29, 2023
1 parent bce8303 commit 91b97a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2023-07-29 Araki Ken <arakiken@users.sf.net>

* ui_screen.c: convert_char_index_to_x() never returns minus value.

2023-06-11 Araki Ken <arakiken@users.sf.net>

* configure.in, README, README.ja: Additional information of
Expand Down
5 changes: 5 additions & 0 deletions uitoolkit/ui_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ static int convert_char_index_to_x(
x -= ui_calculate_vtchar_width(ui_get_font(screen->font_man, vt_char_font(ch)), ch, NULL);
}
}

if (x < 0) {
/* XXX This causes screen corruption, but avoids segfault in fb, wayland and sdl2. */
x = 0;
}
} else {
/*
* excluding the last char width.
Expand Down

0 comments on commit 91b97a0

Please sign in to comment.