[ODE] Patch fo use of uninitialised value of size 8 in checkMass(dMass*)

Francisco Jesús Martínez Serrano franjesus at medtelecom.net
Wed Jun 11 05:58:01 2003


El Martes, 10 jun, 2003, a las 23:41 Europe/Madrid, Martin C. Martin 
escribió:

> Hi,
>
> I've applied this patch (actually, I did it slightly differently) and
> updated CVS.  I've also change text_boxstack and text_collision to work
> with MSVC's quaint for-scoping rules.  Olivier, could you check the
> current CVS version and see if it's valgrind clean?
>
> Thanks,
> Martin
>
> Olivier Michel wrote:
>>
>> The patch is the following: replace line 62 of mass.cpp:
>>
>>   for (int i=0; i<12; i++) I2[i] = m->I[i] + m->mass*I2[i];
>>
>> by the following:
>>
>>   for (int i=0; i<12; i++) if (i%4!=3) I2[i] = m->I[i] + 
>> m->mass*I2[i];

Greetings,
I'm not an expert in this kind of subjects, but actually I believe 
there is plenty of things like this in the ODE code, since it uses 
dReal[4] as dVector3 and dReal[12] as dMatrix3. If you do that kind of 
things, the possibility of SIMD optimization will be lost.

Btw, some thing like

#define dADDVector3(A,B,C) \
   (A)[0] = (B)[0] +(C)[0] ; \
   (A)[1] = (B)[1] +(C)[1] ; \
   (A)[2] = (B)[2] +(C)[2] ;

#define dADDMatrix3(A,B,C) \
   dADDVector3((A),(B),(C)) ; \
   dADDVector3((A+4),(B+4),(C+4)) ; \
   dADDVector3((A+8),(B+8),(C+8)) ;

and the corresponding C++ definitions would be nice in order to have 
the possibility of changing all that operations in a single edit. I 
know: nasty use of C preprocessor, just an idea.