From 259f15da6f1637afe6a1236124076b16d4dd4b6b Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Wed, 17 Jul 2013 00:06:53 +0200 Subject: [PATCH] Apply box2d heap tickler patch: make sure ChainShape:getPoints has enough stack size --- src/modules/physics/box2d/wrap_ChainShape.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/physics/box2d/wrap_ChainShape.cpp b/src/modules/physics/box2d/wrap_ChainShape.cpp index b210a734b..cfbeb24aa 100644 --- a/src/modules/physics/box2d/wrap_ChainShape.cpp +++ b/src/modules/physics/box2d/wrap_ChainShape.cpp @@ -92,6 +92,8 @@ int w_ChainShape_getPoints(lua_State *L) ChainShape *c = luax_checkchainshape(L, 1); const b2Vec2 *verts = c->getPoints(); int count = c->getVertexCount(); + if (!lua_checkstack(L, count*2)) + return luaL_error(L, "Too many return values"); for (int i = 0; i < count; i++) { b2Vec2 v = Physics::scaleUp(verts[i]);