1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-15 17:35:37 +02: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
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);