projects
/
zefram
/
minetest
/
minetest_engine.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
20e3d55
)
Cavegen: Fix possible out-of-bounds heightmap access
author
kwolekr
<kwolekr@minetest.net>
Sun, 1 Dec 2013 13:57:35 +0000
(08:57 -0500)
committer
kwolekr
<kwolekr@minetest.net>
Sun, 1 Dec 2013 13:57:35 +0000
(08:57 -0500)
src/cavegen.cpp
patch
|
blob
|
history
diff --git
a/src/cavegen.cpp
b/src/cavegen.cpp
index 71f005d5bab9617ec94a773fcdf2abff7f154b4e..f04c02db9c1635ee393762d8365c03add03b6c5f 100644
(file)
--- a/
src/cavegen.cpp
+++ b/
src/cavegen.cpp
@@
-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)