From fc2df06f9bc35a4f7d42ac845c914b9dd8179360 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Thu, 19 Aug 2010 19:48:00 +0000 Subject: [PATCH] bug no. 3047884 --- ChangeLog | 4 ++++ src/frontend/inp.c | 12 ++++++++++-- src/frontend/numparam/xpressn.c | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d39620b2..bd3b8f298 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ 2010-08-19 Holger Vogt + * xpressn.c: bug no. 3047884 fixed + inp.c: prevent crash if .param is last line in input deck + +2010-08-18 Holger Vogt * configure.in: add TCLCYG * autogen.sh: if --adms is selected, read the section from configure.in and store it in AC_CONFIG_FILES of temporary temp-adms.ac. diff --git a/src/frontend/inp.c b/src/frontend/inp.c index a7b8c29cb..f42b93c7e 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -591,9 +591,17 @@ inp_spsource(FILE *fp, bool comfile, char *filename) if ( ciprefix( ".param", dd->li_line ) ) { ft_curckt->ci_param = dd; /* find end of .param statements */ - while ( ciprefix( ".param", dd->li_line ) ) { prev_param = dd; dd = dd->li_next; } + while ( ciprefix( ".param", dd->li_line ) ) { + prev_param = dd; + dd = dd->li_next; + if (dd == NULL) break; // no line after .param line + } prev_card->li_next = dd; - prev_param->li_next = NULL; + prev_param->li_next = NULL; + if (dd == NULL) { + fprintf(cp_err, "Warning: Missing .end card!\n"); + break; // no line after .param line + } } if ( ciprefix( ".meas", dd->li_line ) ) { diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index b6e077900..6d2e1513d 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -953,7 +953,7 @@ fetchoperator (tdico * dico, state = 2; level = 2; } - else if (cpos (c, "=<>#GL") > 0) + else if (cpos (c, "=<>#GL") >= 0) { state = 2; level = 5;