mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Cavegen: Fix possible out-of-bounds heightmap access
This commit is contained in:
parent
20e3d550fa
commit
f3439c40d8
1 changed files with 2 additions and 1 deletions
|
@ -518,7 +518,8 @@ void CaveV7::carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine) {
|
|||
v3s16 p(cp.X + x0, cp.Y + y0, cp.Z + z0);
|
||||
p += of;
|
||||
|
||||
if (!is_ravine && mg->heightmap && should_make_cave_hole) {
|
||||
if (!is_ravine && mg->heightmap && should_make_cave_hole &&
|
||||
p.X <= node_max.X && p.Z <= node_max.Z) {
|
||||
int maplen = node_max.X - node_min.X + 1;
|
||||
int idx = (p.Z - node_min.Z) * maplen + (p.X - node_min.X);
|
||||
if (p.Y >= mg->heightmap[idx] - 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue