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

Function ProtectedLuaDDFBufferOverflow

engine/script/src/test/test_script_ddf.cpp:377–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375};
376
377static int ProtectedLuaDDFBufferOverflow(lua_State *L)
378{
379 LuaDDFBufferOverflowParam* p = (LuaDDFBufferOverflowParam*) lua_touserdata(L, 1);
380
381 lua_newtable(L);
382 lua_pushinteger(L, 100);
383 lua_setfield(L, -2, "uint_value");
384
385 lua_pushstring(L, "string_value");
386 lua_setfield(L, -2, "string_value");
387
388 uint32_t buffer_size = dmScript::CheckDDF(L, TestScript::LuaDDFBufferOverflow::m_DDFDescriptor, p->m_Buf, p->m_BufferSize, -1);
389 assert(buffer_size == sizeof(TestScript::LuaDDFBufferOverflow) + strlen("string_value") + 1);
390 return 0;
391}
392
393TEST_F(ScriptDDFTest, LuaDDFBufferOverflowToDDF)
394{

Callers

nothing calls this directly

Calls 6

lua_touserdataFunction · 0.85
lua_pushintegerFunction · 0.85
lua_setfieldFunction · 0.85
lua_pushstringFunction · 0.85
CheckDDFFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected