gedit crashes at startup with BOM + 0x0a for ini files
When opening an empty .ini file starting with the following bytes, gedit crashes in gtksourceview:
ef bb bf 0a
Steps to reproduce:
xxd -r >foo.ini <<EOF
00000000 ef bb bf 0a
EOF
gedit foo.ini
Can reproduce with:
- gedit - Version 3.38.0 on macOS Catalina + libgtksourceview4 4.8.0 (Homebrew)
- gedit - Version 3.36.2 on Ubuntu 20.04.1 LTS + libgtksourceview-4-0 4.6.0-1
This might very well be a libgtksourceview issue, but it's easy to reproduce with gedit, so I filed it here, let me know if I should file it in https://gitlab.gnome.org/GNOME/gtksourceview instead.
Also, it only happens when opening the file from the command line / at startup (gedit foo.ini
), not when opening gedit without a file and using the "Open" button / file chooser to select foo.ini
.
Traceback:
Thread 1 "gedit" received signal SIGSEGV, Segmentation fault.
0x00007ffff6e5c683 in segment_remove (ce=0x5555563a2580 [GtkSourceContextEngine], segment=0x555556426400)
at ../gtksourceview/gtksourcecontextengine.c:4875
4875 ../gtksourceview/gtksourcecontextengine.c: No such file or directory.
(gdb) bt
#0 0x00007ffff6e5c683 in segment_remove (ce=0x5555563a2580 [GtkSourceContextEngine], segment=0x555556426400)
at ../gtksourceview/gtksourcecontextengine.c:4875
#1 0x00007ffff6e6021b in update_syntax
(ce=ce@entry=0x5555563a2580 [GtkSourceContextEngine], end=end@entry=0x0, time=time@entry=10)
at ../gtksourceview/gtksourcecontextengine.c:5402
#2 0x00007ffff6e6051f in first_update_callback (ce=0x5555563a2580 [GtkSourceContextEngine])
at ../gtksourceview/gtksourcecontextengine.c:2374
#3 0x00007ffff7090f4d in gdk_threads_dispatch (data=0x5555557d1ac0) at ../../../../gdk/gdk.c:769
#4 0x00007ffff7969e8e in g_main_dispatch (context=0x55555558c960) at ../../../glib/gmain.c:3309
#5 g_main_context_dispatch (context=context@entry=0x55555558c960) at ../../../glib/gmain.c:3974
#6 0x00007ffff796a240 in g_main_context_iterate
(context=context@entry=0x55555558c960, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
at ../../../glib/gmain.c:4047
#7 0x00007ffff796a2e3 in g_main_context_iteration
(context=context@entry=0x55555558c960, may_block=may_block@entry=1) at ../../../glib/gmain.c:4108
#8 0x00007ffff7d4ffd5 in g_application_run
(application=0x55555558a190 [GeditAppX11], argc=<optimized out>, argv=<optimized out>)
at ../../../gio/gapplication.c:2559
#9 0x0000555555555346 in main (argc=2, argv=0x7fffffffdd28) at ../gedit/gedit.c:148