[Kstars-devel] Suspicious code in KStars

Anne-Marie Mahfouf annemarie.mahfouf at free.fr
Wed Oct 8 21:56:19 CEST 2008


A guy working at IBM can use a private tool to check code and he did kdeedu.
Here is what he found for KStars

- kdeedu/kstars/kstars/htmesh/RangeConvex.cpp:1150

If line 1143 is false but line 1144 true then line 1149 is false and line 
1150
uses an uninitialized root1. Analogue for root2.

- kdeedu/kstars/kstars/htmesh/RangeConvex.cpp:341

Is it sure that k1, k2, c1 and c2 are initialized?

- kdeedu/kstars/kstars/htmesh/SkipList.cpp:446

Division by 0 if count == 0;

- kdeedu/kstars/kstars/htmesh/SpatialEdge.cpp:130

Is k always in the range [0,2]?

- kdeedu/kstars/kstars/indi/drivers/telescope/lx200generic.cpp:1472

Where is the closing parenthesis? The one in line 1487?

- kdeedu/kstars/kstars/indi/drivers/telescope/lx200generic.cpp:1658

err is not initialized here.

- kdeedu/kstars/kstars/skycomponents/starcomponent.cpp:144

Add a todo comment to not forget this issue.

- kdeedu/kstars/kstars/skycomponents/constellationboundarylines.cpp:129

If line 106 is not visited then polyList is NULL here.

- kdeedu/kstars/kstars/skycomponents/starblock.cpp:78

plainStarTemplate is a pointer. Therefore &plainStarTemplate is a pointer to 
a
pointer. The memory pointed at is only sizeof(void*) bytes long. Not
sizeof(StarObject).

- kdeedu/kstars/kstars/kswizard.cpp:164

If line 155 is false then Geo is NULL here.

- kdeedu/kstars/kstars/starobject.cpp:209-213

= instead of == here?

- kdeedu/kstars/kstars/binfilehelper.cpp:120

Leaking the pointer from line 118 here.

------------------------------------------

If you could have a look, usually the check is right and point to a potential 
problem.

Thanks in advance,

Anne-Marie



More information about the Kstars-devel mailing list