fix dangerous things, potential bugs, at least for big endian machines
This commit is contained in:
parent
e95eb0d4aa
commit
62afa50a1c
15
ChangeLog
15
ChangeLog
|
|
@ -1,3 +1,18 @@
|
|||
2010-07-24 Robert Larice
|
||||
fix dangerous things, potential bugs, at least for big endian machines
|
||||
* src/frontend/inp.c ,
|
||||
a bool (unsigned char) and an int have been mixed,
|
||||
and the address of the thing was taken.
|
||||
should fail on a big endian machine
|
||||
* src/frontend/spiceif.c ,
|
||||
the value of an union, made of a bool (unsigned char), an int, etc,
|
||||
is silently cast into an int.
|
||||
This can introduce stack noise, in the CP_BOOL case
|
||||
* src/frontend/variable.c :
|
||||
a `variable' is created with type CP_NUM,
|
||||
but only bool was initialized.
|
||||
This can introduce stack noise.
|
||||
|
||||
2010-07-24 Robert Larice
|
||||
* src/include/onedev.h ,
|
||||
* src/include/twodev.h :
|
||||
|
|
|
|||
|
|
@ -697,7 +697,6 @@ inp_dodeck(
|
|||
wordlist *wl;
|
||||
bool noparse, ii;
|
||||
int print_listing;
|
||||
static int one;
|
||||
|
||||
/* First throw away any old error messages there might be and fix
|
||||
the case of the lines. */
|
||||
|
|
@ -882,7 +881,7 @@ inp_dodeck(
|
|||
}
|
||||
*/
|
||||
for (eev = ct->ci_vars; eev; eev = eev->va_next) {
|
||||
one = 1;
|
||||
bool one = TRUE; /* FIXME, actually eev->va_bool should be TRUE anyway */
|
||||
switch (eev->va_type) {
|
||||
case CP_BOOL:
|
||||
if_option(ct->ci_ckt, eev->va_name,
|
||||
|
|
|
|||
|
|
@ -472,8 +472,12 @@ if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value)
|
|||
goto badtype;
|
||||
break;
|
||||
case IF_FLAG:
|
||||
/* Do nothing. */
|
||||
pval.iValue = *((int *) value);
|
||||
if (type == CP_BOOL)
|
||||
pval.iValue = *((bool *) value) ? 1 : 0;
|
||||
else if (type == CP_NUM) /* FIXME, shall we allow this ? */
|
||||
pval.iValue = *((int *) value);
|
||||
else
|
||||
goto badtype;
|
||||
break;
|
||||
default:
|
||||
fprintf(cp_err,
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ cp_remvar(char *varname)
|
|||
ZERO(v, struct variable);
|
||||
v->va_name = copy(varname);
|
||||
v->va_type = CP_NUM;
|
||||
v->va_bool = 0;
|
||||
v->va_num = 0;
|
||||
found = FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue