MCPcopy Create free account
hub / github.com/defold/defold / ProduceIndexOutOfBounds

Function ProduceIndexOutOfBounds

engine/script/src/test/test_script_table.cpp:205–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203const uint32_t IOOB_BUFFER_SIZE = 8 + 2 + 2 + (sizeof(char) + sizeof(char) + 5 * sizeof(char) + sizeof(lua_Number));
204
205static int ProduceIndexOutOfBounds(lua_State *L)
206{
207 char DM_ALIGNED(16) buf[IOOB_BUFFER_SIZE];
208 lua_newtable(L);
209 // invalid key
210 lua_pushnumber(L, 0xffffffffLL+1);
211 // value
212 lua_pushnumber(L, 0);
213 // store pair
214 lua_settable(L, -3);
215 uint32_t buffer_used = dmScript::CheckTable(L, buf, IOOB_BUFFER_SIZE, -1);
216 // expect it to fail, avoid warning
217 (void)buffer_used;
218 return 1;
219}
220
221TEST_F(LuaTableTest, IndexOutOfBounds)
222{

Callers

nothing calls this directly

Calls 3

lua_pushnumberFunction · 0.85
lua_settableFunction · 0.85
CheckTableFunction · 0.85

Tested by

no test coverage detected