1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +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

@ -270,6 +270,7 @@ ParticleSpawner::ParticleSpawner(
}
size_t max_particles = 0; // maximum number of particles likely to be visible at any given time
assert(p.time >= 0);
if (p.time != 0) {
auto maxGenerations = p.time / std::min(p.exptime.start.min, p.exptime.end.min);
max_particles = p.amount / maxGenerations;