Skip to content

Avoid undefined behavior with NULL msgid strings and dgettext

Example UBSan warnings

glib/ggettext.c:404:10: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x7253e423e903 in g_dgettext glib/ggettext.c:404
    #1 0x7253e7f87e22 in IA__xfce_gtk_translate_action_entries libxfce4ui/xfce-gtk-extensions.c:616
    #2 0x6064dc82c28b in thunar_window_class_init thunar/thunar-window.c:767
    #3 0x6064dc82c28b in thunar_window_class_intern_init thunar/thunar-window.c:738
    #4 0x7253e3be8098 in type_class_init_Wm gobject/gtype.c:2319
    #5 0x7253e3be8098 in g_type_class_ref gobject/gtype.c:3034
    #6 0x7253e3b878b5 in g_object_new_valist gobject/gobject.c:2877
    #7 0x7253e3b8911b in g_object_new gobject/gobject.c:2418
    #8 0x6064dc685a0a in thunar_application_open_window thunar/thunar-application.c:1493
    #9 0x6064dc6b0d9e in thunar_dbus_freedesktop_show_folders thunar/thunar-dbus-service.c:1569
[...snip...]

glib/ggettext.c:404:10: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x73722a83e903 in g_dgettext glib/ggettext.c:404
    #1 0x73722e656d72 in IA__xfce_gtk_translate_action_entries libxfce4ui/xfce-gtk-extensions.c:617
    #2 0x650d7f2e0d26 in terminal_window_class_init xfce4-terminal/terminal/terminal-window.c:410
    #3 0x650d7f2e0d26 in terminal_window_class_intern_init xfce4-terminal/terminal/terminal-window.c:388
    #4 0x73722b1e8098 in type_class_init_Wm gobject/gtype.c:2319
    #5 0x73722b1e8098 in g_type_class_ref gobject/gtype.c:3034
    #6 0x73722b1878b5 in g_object_new_valist gobject/gobject.c:2877
    #7 0x73722b18911b in g_object_new gobject/gobject.c:2418
    #8 0x650d7f2eec6f in terminal_window_new xfce4-terminal/terminal/terminal-window.c:2667
    #9 0x650d7f2928e8 in terminal_app_create_window xfce4-terminal/terminal/terminal-app.c:366
    #10 0x650d7f295f84 in terminal_app_open_window xfce4-terminal/terminal/terminal-app.c:1043
    #11 0x650d7f297d60 in terminal_app_process xfce4-terminal/terminal/terminal-app.c:1258
    #12 0x650d7f290c1a in main xfce4-terminal/terminal/main.c:339

Testing

  • No issues were detected when testing the patch with UBSan, LSan, and ASan
  • I verified that tooltip and label text still appear in Thunar and xfce4-terminal

Merge request reports

Loading