Skip to content

Instantly share code, notes, and snippets.

@hamano
Created July 25, 2019 07:45
Show Gist options
  • Save hamano/e43624c6bda2250cb4a0c8116926c7f5 to your computer and use it in GitHub Desktop.
Save hamano/e43624c6bda2250cb4a0c8116926c7f5 to your computer and use it in GitHub Desktop.
--- mlterm-3.8.8.orig/uitoolkit/ui_im_candidate_screen.c
+++ mlterm-3.8.8/uitoolkit/ui_im_candidate_screen.c
@@ -83,7 +83,7 @@ static u_int candidate_width(ui_font_man
width = 0;
ui_font_manager_set_attr(font_man, 0, 0);
- for (i = 0; i < candidate->filled_len; i++) {
+ for (i = 0; i < candidate->num_chars; i++) {
ui_font_t *font;
font = ui_get_font(font_man, vt_char_font(&candidate->chars[i]));
@@ -320,7 +320,7 @@ static void draw_screen_vertical(ui_im_c
* |1 cand0 |
* ^^^^^
*/
- draw_str(cand_screen, cand_screen->candidates[i].chars, cand_screen->candidates[i].filled_len,
+ draw_str(cand_screen, cand_screen->candidates[i].chars, cand_screen->candidates[i].num_chars,
font->width * (num_digits + 1), i - top, font->height, font->ascent, 1);
}
@@ -760,7 +760,7 @@ static int select_candidate(ui_im_candid
cand = &cand_screen->candidates[cand_screen->index];
if (cand->chars) {
- for (i = 0; i < cand->filled_len; i++) {
+ for (i = 0; i < cand->num_chars; i++) {
vt_char_set_fg_color(&cand->chars[i], VT_FG_COLOR);
vt_char_set_bg_color(&cand->chars[i], VT_BG_COLOR);
}
@@ -769,7 +769,7 @@ static int select_candidate(ui_im_candid
cand = &cand_screen->candidates[index];
if (cand->chars) {
- for (i = 0; i < cand->filled_len; i++) {
+ for (i = 0; i < cand->num_chars; i++) {
vt_char_set_fg_color(&cand->chars[i], VT_BG_COLOR);
vt_char_set_bg_color(&cand->chars[i], VT_FG_COLOR);
}
@hamano
Copy link
Author

hamano commented Jul 25, 2019

backtraceです、これ以外にも同様のnullアクセスがありました。

Program received signal SIGSEGV, Segmentation fault.
vt_char_set_fg_color (ch=0x5555558be228, color=color@entry=VT_FG_COLOR) at vt_char.c:707
707     vt_char.c: そのようなファイルやディレクトリはありません.
(gdb) bt
#0  0x00007ffff7dab7ab in vt_char_set_fg_color (ch=0x5555558be228, color=color@entry=VT_FG_COLOR)
    at vt_char.c:707
#1  0x0000555555591b0c in select_candidate (cand_screen=0x5555558cd180, index=0) at ui_im_candidate_screen.c:764
#2  0x00007ffff48bdd87 in  () at /usr/lib/x86_64-linux-gnu/mlterm/libim-uim.so
#3  0x00007ffff487f589 in  () at /usr/lib/x86_64-linux-gnu/libuim.so.8
#4  0x00007ffff489bb8c in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#5  0x00007ffff489c3df in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#6  0x00007ffff4670bed in GCROOTS_call_with_gc_ready_stack () at /usr/lib/x86_64-linux-gnu/libgcroots.so.0
#7  0x00007ffff48ab963 in uim_scm_callf () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#8  0x00007ffff44e0ee5 in  () at /usr/lib/x86_64-linux-gnu/uim/plugin/libuim-mozc.so
#9  0x00007ffff44e2367 in  () at /usr/lib/x86_64-linux-gnu/uim/plugin/libuim-mozc.so
#10 0x00007ffff489bb6c in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#11 0x00007ffff489be09 in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#12 0x00007ffff48a71f4 in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#13 0x00007ffff489bb6c in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#14 0x00007ffff489be09 in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#15 0x00007ffff48a6cb3 in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#16 0x00007ffff489bb8c in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#17 0x00007ffff489be09 in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#18 0x00007ffff489bf10 in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#19 0x00007ffff489c097 in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#20 0x00007ffff489bb8c in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#21 0x00007ffff489be09 in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#22 0x00007ffff489c414 in  () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#23 0x00007ffff4670bed in GCROOTS_call_with_gc_ready_stack () at /usr/lib/x86_64-linux-gnu/libgcroots.so.0
#24 0x00007ffff48ab963 in uim_scm_callf () at /usr/lib/x86_64-linux-gnu/libuim-scm.so.0
#25 0x00007ffff487eeb3 in  () at /usr/lib/x86_64-linux-gnu/libuim.so.8
#26 0x00007ffff487efe0 in uim_press_key () at /usr/lib/x86_64-linux-gnu/libuim.so.8
#27 0x00007ffff48bcc62 in  () at /usr/lib/x86_64-linux-gnu/mlterm/libim-uim.so
#28 0x0000555555578389 in key_pressed (win=0x55555580f390, event=0x7fffffffd650) at ui_screen.c:2042
#29 0x000055555556c948 in ui_window_receive_event (win=0x55555580f390, event=0x7fffffffd650)
    at ../uitoolkit/xlib/ui_window.c:1966
#30 0x000055555556d8e5 in ui_window_receive_event (win=0x555555813150, event=event@entry=0x7fffffffd650)
    at ../uitoolkit/xlib/ui_window.c:1830
#31 0x0000555555568577 in ui_display_receive_next_event (disp=0x5555557d6600)
    at ../uitoolkit/xlib/ui_display.c:437
#32 0x0000555555592870 in receive_next_event () at ui_event_source.c:233
#33 0x0000555555592870 in ui_event_source_process () at ui_event_source.c:306
#34 0x0000555555565be5 in main_loop_start () at main_loop.c:522
#35 0x0000555555564c87 in main (argc=1, argv=0x7fffffffd998) at main.c:158
(gdb) up
#1  0x0000555555591b0c in select_candidate (cand_screen=0x5555558cd180, index=0) at ui_im_candidate_screen.c:764
764     ui_im_candidate_screen.c: そのようなファイルやディレクトリはありません.
(gdb) print i
$1 = 1
(gdb) print cand->chars[i]
$2 = {u = {ch = {attr = 0, fg_color = 0, bg_color = 0, attr2 = 0, code = 0}, multi_ch = 0x0}}
(gdb)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment