[Bf-committers] Possible bug, uninitialized var in depsgraph.c

bjornmose bjornmose at gmx.net
Wed Jul 13 00:12:55 CEST 2005


Hi jean-luc,ton

found a piece of code MSVC6 does not really like.
Not sure if it is a MSVC6 special, anyway it causes my build to throw a 
'final' exception.

struct DagForest *build_dag(struct Scene *sce, short mask)
				char *subtarget; // hum local variable on stack may hold some garbage
// so this may shoot a zero to *anywhere* since subtarget was not 
initialized
...
							subtarget= "";
...

							target = get_constraint_target(con, &subtarget);
// didn't check but i think this sets subtarget to be a valid pointer OR 
  NULL
.....
if(subtarget[0]) <-- MSCV6 build stalls here since subtarget is NULL ( 
trying to READ OUT the first element subtarget points to and reading out 
a NULL pointer seems illegal to MSVC6 and me )
.....									

sooo-------
if get_constraint_target(con, &subtarget); returns a valid pointer or NULL
it should read
...
if(subtarget) // make sure it is not NULL
...
       if(subtarget[0]) //see if char-array is empty

making sure subtarget points to anything at all, then there is a need to 
check if the char-array starts with a ZERO

again i may be utterly wrong (* time to quit job as software pro and 
start growing wine at bordeaux *)

OLE



More information about the Bf-committers mailing list