1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Sanitize invalid particle spawner time (#15465)

This commit is contained in:
Lars Müller 2024-11-24 19:23:53 +01:00 committed by GitHub
parent 11b19cd126
commit b77ad82fb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 0 deletions

View file

@ -3,6 +3,7 @@
// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
#include "lua_api/l_particles.h"
#include "common/c_types.h"
#include "lua_api/l_object.h"
#include "lua_api/l_internal.h"
#include "lua_api/l_particleparams.h"
@ -280,6 +281,9 @@ int ModApiParticles::l_add_particlespawner(lua_State *L)
p.node_tile = getintfield_default(L, 1, "node_tile", p.node_tile);
}
if (p.time < 0)
throw LuaError("particle spawner 'time' must be >= 0");
u32 id = getServer(L)->addParticleSpawner(p, attached, playername);
lua_pushnumber(L, id);