check for shorted voltage sources, to avoid a segmentation fault

This commit is contained in:
rlar 2010-08-15 17:16:51 +00:00
parent bfc6636b61
commit 5c59267768
5 changed files with 32 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2010-08-15 Robert Larice
* src/spicelib/devices/asrc/asrcset.c ,
* src/spicelib/devices/ccvs/ccvsset.c ,
* src/spicelib/devices/vcvs/vcvsset.c ,
* src/spicelib/devices/vsrc/vsrcset.c :
check for shorted voltage sources, to avoid a segmentation fault
2010-08-15 Robert Larice
* src/maths/sparse/spdefs.h :
fix txfree() prototype

View File

@ -64,6 +64,13 @@ if((here->ptr = SMPmakeElt(matrix, here->first, (second)->number))\
return E_PARMVAL;
if( here->ASRCtype == ASRC_VOLTAGE) {
if(here->ASRCposNode == here->ASRCnegNode) {
(*(SPfrontEnd->IFerror))(ERR_FATAL,
"instance %s is a shorted ASRC", &here->ASRCname);
return(E_UNSUPP);
}
here->ASRCposptr = (double **)
REALLOC(here->ASRCposptr, (sizeof(double *)*(j+5)));
TSTALLOC(ASRCposptr[j++],ASRCposNode,ASRCbranch);

View File

@ -29,6 +29,12 @@ CCVSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
for (here = model->CCVSinstances; here != NULL ;
here=here->CCVSnextInstance) {
if(here->CCVSposNode == here->CCVSnegNode) {
(*(SPfrontEnd->IFerror))(ERR_FATAL,
"instance %s is a shorted CCVS", &here->CCVSname);
return(E_UNSUPP);
}
if(here->CCVSbranch==0) {
error = CKTmkCur(ckt,&tmp,here->CCVSname, "branch");
if(error) return(error);

View File

@ -30,6 +30,12 @@ VCVSsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
for (here = model->VCVSinstances; here != NULL ;
here=here->VCVSnextInstance) {
if(here->VCVSposNode == here->VCVSnegNode) {
(*(SPfrontEnd->IFerror))(ERR_FATAL,
"instance %s is a shorted VCVS", &here->VCVSname);
return(E_UNSUPP);
}
if(here->VCVSbranch == 0) {
error = CKTmkCur(ckt,&tmp,here->VCVSname,"branch");
if(error) return(error);

View File

@ -29,6 +29,12 @@ VSRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *state)
for (here = model->VSRCinstances; here != NULL ;
here=here->VSRCnextInstance) {
if(here->VSRCposNode == here->VSRCnegNode) {
(*(SPfrontEnd->IFerror))(ERR_FATAL,
"instance %s is a shorted VSRC", &here->VSRCname);
return(E_UNSUPP);
}
if(here->VSRCbranch == 0) {
error = CKTmkCur(ckt,&tmp,here->VSRCname,"branch");
if(error) return(error);