From f3cb69403ad480957531dc20b8784b57ce7c8376 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 3 Oct 2021 18:41:30 +0200 Subject: [PATCH] bug 497: Prevent a crash in CPL Forbiddeb combination of model parameters. Details are not yet available. --- src/spicelib/devices/cpl/cplload.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/spicelib/devices/cpl/cplload.c b/src/spicelib/devices/cpl/cplload.c index 5b4c9b32b..6dbb3b434 100644 --- a/src/spicelib/devices/cpl/cplload.c +++ b/src/spicelib/devices/cpl/cplload.c @@ -201,6 +201,10 @@ CPLload(GENmodel *inModel, CKTcircuit *ckt) double a, b; tms = cp->h1t[i][j]; + if (!tms) { + fprintf(stderr, "\nError in CPL %s: Forbidden combination of model parameters!\n", here->gen.GENname); + controlled_exit(1); + } if (tms->ifImg) { tms->tm[0].cnv_i = - cp->dc1[j] * tms->tm[0].c / tms->tm[0].x; @@ -222,6 +226,10 @@ CPLload(GENmodel *inModel, CKTcircuit *ckt) for (l = 0; l < cp->noL; l++) { tms = cp->h2t[i][j][l]; + if (!tms) { + fprintf(stderr, "\nError in CPL %s: Forbidden combination of model parameters!\n", here->gen.GENname); + controlled_exit(1); + } for (k = 0; k < 3; k++) { tms->tm[k].cnv_i = 0.0; tms->tm[k].cnv_o = 0.0; @@ -229,6 +237,10 @@ CPLload(GENmodel *inModel, CKTcircuit *ckt) } for (l = 0; l < cp->noL; l++) { tms = cp->h3t[i][j][l]; + if (!tms) { + fprintf(stderr, "\nError in CPL %s: Forbidden combination of model parameters!\n", here->gen.GENname); + controlled_exit(1); + } if (tms->ifImg) { tms->tm[0].cnv_i = - cp->dc1[j] * tms->tm[0].c / tms->tm[0].x;