[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tic crash with unresolved use
From: |
Miroslav Lichvar |
Subject: |
tic crash with unresolved use |
Date: |
Thu, 6 May 2021 12:40:34 +0200 |
This was reported by the clang static analyzer and confirmed with
the following test:
foo|description,
use=nosuchterm, use=xterm
This causes a crash in _nc_resolve_uses2() in the new code recently
added to check for duplicate use.
A possible fix:
--- a/ncurses/tinfo/comp_parse.c
+++ b/ncurses/tinfo/comp_parse.c
@@ -457,7 +457,8 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
/* verify that there are no earlier uses */
for (j = 0; j < i; ++j) {
- if (!strcmp(qp->uses[j].link->tterm.term_names,
+ if (qp->uses[j].link &&
+ !strcmp(qp->uses[j].link->tterm.term_names,
rp->tterm.term_names)) {
_nc_warning("duplicate use=%s", lookfor);
break;
@@ -487,7 +488,8 @@ _nc_resolve_uses2(bool fullresolve, bool literal)
/* verify that there are no earlier uses */
for (j = 0; j < i; ++j) {
- if (!strcmp(qp->uses[j].link->tterm.term_names,
+ if (qp->uses[j].link &&
+ !strcmp(qp->uses[j].link->tterm.term_names,
rp->tterm.term_names)) {
_nc_warning("duplicate use=%s", lookfor);
break;
--
Miroslav Lichvar
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- tic crash with unresolved use,
Miroslav Lichvar <=