Browse Source

check for shorted voltage sources, to avoid a segmentation fault

pre-master-46
rlar 16 years ago
parent
commit
5c59267768
  1. 7
      ChangeLog
  2. 7
      src/spicelib/devices/asrc/asrcset.c
  3. 6
      src/spicelib/devices/ccvs/ccvsset.c
  4. 6
      src/spicelib/devices/vcvs/vcvsset.c
  5. 6
      src/spicelib/devices/vsrc/vsrcset.c

7
ChangeLog

@ -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

7
src/spicelib/devices/asrc/asrcset.c

@ -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);

6
src/spicelib/devices/ccvs/ccvsset.c

@ -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);

6
src/spicelib/devices/vcvs/vcvsset.c

@ -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);

6
src/spicelib/devices/vsrc/vsrcset.c

@ -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);

Loading…
Cancel
Save