After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 312260 - vte segfaults if no termcap file is found
vte segfaults if no termcap file is found
Status: RESOLVED FIXED
Product: vte
Classification: Core
Component: general
unspecified
Other Linux
: High major
: ---
Assigned To: VTE Maintainers
VTE Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-08-01 17:09 UTC by Michele Baldessari
Modified: 2005-08-12 19:51 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Fixes the destroy segfault on NULL termcap struct (513 bytes, patch)
2005-08-01 17:10 UTC, Michele Baldessari
none Details | Review

Description Michele Baldessari 2005-08-01 17:09:03 UTC
1) vte_terminal_set_emulation calls vte_terminal_set_termcap(terminal, NULL, FALSE);
2) vte_terminal_set_termcap gets passed NULL as path and hence it tries to first
open:
        wpath = g_strdup_printf(DATADIR "/" PACKAGE "/termcap/%s",
                                terminal->pvt->emulation ?
                                terminal->pvt->emulation :
                                vte_terminal_get_default_emulation(terminal));
        if (stat(wpath, &st) != 0) {
                g_free(wpath);
                wpath = g_strdup("/etc/termcap");
        }

   If we don't find both files (DATADIR "/" PACKAGE "/termcap/%s" _and_
/etc/termcap)
3) _vte_termcap_new(NULL) gets called and from there on the _vte_termcap termcap
variable is
   NULL all the time and we trigger a whole bunch of "_vte_termcap_find:
assertion `termcap != NULL' failed" warnings.
   We also end up in a segfault as soon as we _vte_termcap_destroy gets called
by the g_cache cleanup handlers
   since we have:

   for (entry = termcap->entries; entry != NULL; entry = nextentry) {

   at the beginning of that function.

I'll attach a patch that fixes the destroy handler to not crash. We could also
simply refuse to start if no termcap
file.
Comment 1 Michele Baldessari 2005-08-01 17:10:45 UTC
Created attachment 50081 [details] [review]
Fixes the destroy segfault on NULL termcap struct
Comment 2 Brent Smith (smitten) 2005-08-02 16:51:48 UTC
Marking new because of the patch, and setting priority to High, and severity to
major because of the segfault.  The system is broken if there is no
termcap, but we shouldn't segfault.
Comment 3 Kjartan Maraas 2005-08-12 19:51:57 UTC
Commited.