sasikalar / gamekit

Automatically exported from code.google.com/p/gamekit
0 stars 0 forks source link

gkConstraintManager::update possible NULL pointer dereference. #157

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?
trunk on Linux/WinNt

Please provide any additional information below.
gkConstraintManager::update doesn't check some pointers allowing possible NULL 
pointer dereference. Perhaps this isn't really needed, is it gaurenteed that 
the constraint pointer will be a valid object and all indexes into it? Patch 
included.

Original issue reported on code.google.com by bsd...@gmail.com on 15 Mar 2011 at 8:30

Attachments:

GoogleCodeExporter commented 9 years ago
I think those extra check are not necessary.

If m_updateConstraints is not empty then p will not be null.
And later gkConstraint* co = p[i++]; "co" will never be null neither (normally) 
but you can add a GK_ASSERT to detect bug in debug build only so it will not 
slow down release builds.

Original comment by xavier.thomas.1980@gmail.com on 17 Mar 2011 at 7:57