GNOME Bugzilla – Bug 616251
segfault loading empty .tex file
Last modified: 2010-05-16 10:32:31 UTC
Created attachment 159138 [details] [review] patch to fix GeditSmartCharsetConverter When GeditLaTeXPlugin is enabled, opening an empty .tex file causes segmentation fault: $ touch test.tex $ gedit test.tex (gedit:24492): GLib-GIO-CRITICAL **: g_converter_convert: assertion `outbuf_size > 0' failed zsh: segmentation fault (core dumped) gedit test.tex This is because encoding detection in GeditSmartCharsetConverter does not expect empty input. I'll attach a patch with a testcase.
I'm wondering two things, maybe you can answer: 1) How come this only happens when the latex plugin is enabled. What special things does it do to 'interfere' with the file loading process? 2) The assertion seems to be on outbuf_size, but the check in the patch is on inbuf_size. Why is that?
I have no idea on 1). For 2), because outbuf_size is directly calculated from inbuf_size (outbuf_size = inbuf_size * 4) in try_convert() in gedit-smart-charset-converter.c.
Is this still a problem? Has this been fixed in the plugin?
Looking further into the problem, we found that this problem was occuring on empty files when the utf-8 encoding was not in the default list of auto-detected encodings. We have fixed this bug now both on master and on stable and will release a new stable version soon. Thanks for taking the time to report the bug!