From 2e8c0c17ccbdb2b46eed60a33d81d7e130b9a265 Mon Sep 17 00:00:00 2001 From: John Loehrlein Date: Fri, 29 Jun 2007 00:39:48 +0000 Subject: [PATCH] checks size of surface table when adding a surface entry --- panda/src/ode/odeWorld.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/panda/src/ode/odeWorld.cxx b/panda/src/ode/odeWorld.cxx index 93ed8c2818..e2adac1cbc 100755 --- a/panda/src/ode/odeWorld.cxx +++ b/panda/src/ode/odeWorld.cxx @@ -78,6 +78,12 @@ init_surface_table(PN_uint8 num_surfaces) void OdeWorld:: set_surface(int pos1, int pos2, sSurfaceParams& entry) { + odeworld_cat.debug() << " pos1 " << pos1 << " pos2 " << pos2 << " num surfaces " << (int)_num_surfaces << " endline\n"; + if((_num_surfaces <= pos1) || (_num_surfaces <= pos2)) + { + odeworld_cat.error() << "surface position exceeds size of surface table, set num_surface in initSurfaceTable higher." << "\n"; + return; + } int true_pos = (pos1 * _num_surfaces) + pos2; _surface_table[true_pos].colparams.mode = entry.colparams.mode; _surface_table[true_pos].colparams.mu = entry.colparams.mu;