From fd79e4b5c47177aacdd10290bd10e53917151abc Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 20 Nov 2020 22:05:31 +0100 Subject: [PATCH] Don't parse the B source instance parameters, thus prevent memory leaks. --- src/spicelib/parser/inpptree.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/spicelib/parser/inpptree.c b/src/spicelib/parser/inpptree.c index dbae3e913..29c0f9240 100644 --- a/src/spicelib/parser/inpptree.c +++ b/src/spicelib/parser/inpptree.c @@ -1266,6 +1266,8 @@ int PTlex (YYSTYPE *lvalp, struct PTltype *llocp, char **line) int token; sbuf = *line; + + #ifdef TRACE // printf("entering lexer, sbuf = '%s', lastoken = %d, lasttype = %d\n", // sbuf, lasttoken, lasttype); @@ -1368,7 +1370,26 @@ int PTlex (YYSTYPE *lvalp, struct PTltype *llocp, char **line) token = TOK_LT; break; } - + /* Don't parse the B source instance parameters, thus prevent memory leak. + As soon as we meet such parameter, token=0 is returned. */ + case 't': + if (ciprefix("tc1=", sbuf) || ciprefix("tc2=", sbuf) || ciprefix("temp=", sbuf)) { + token = 0; + break; + } + /* FALLTHROUGH */ + case 'd': + if (ciprefix("dtemp=", sbuf)) { + token = 0; + break; + } + /* FALLTHROUGH */ + case 'r': + if (ciprefix("reciproctc=", sbuf)) { + token = 0; + break; + } + /* FALLTHROUGH */ default: { int n1 = -1;