diff options
author | paramat <mat.gregory@virginmedia.com> | 2015-11-30 01:43:28 +0000 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2015-12-01 00:36:38 +0000 |
commit | 57b429574ef92c62d202955535896b36845b88db (patch) | |
tree | 6e481c15a2cf3e354e44e0698bca53728da0cfc2 | |
parent | 6fead2818acf00a63c89ec613230a59bc0c4cab5 (diff) | |
download | minetest-57b429574ef92c62d202955535896b36845b88db.tar.gz minetest-57b429574ef92c62d202955535896b36845b88db.tar.bz2 minetest-57b429574ef92c62d202955535896b36845b88db.zip |
Dungeongen: Fix rarely triggered segfault
A segfault exposed a missing 'vm->m_area.contains()'
check in makeCorridor that allowed the calculation
of vm index for a node outside the vm area. The huge
and invalid index number caused getContent to fail
-rw-r--r-- | src/dungeongen.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dungeongen.cpp b/src/dungeongen.cpp index bfaad9faa..cb5ea97b6 100644 --- a/src/dungeongen.cpp +++ b/src/dungeongen.cpp @@ -392,7 +392,8 @@ void DungeonGen::makeCorridor(v3s16 doorplace, v3s16 doordir, if (partcount != 0) p.Y += make_stairs; - if (vm->m_area.contains(p) && vm->m_area.contains(p + v3s16(0, 1, 0))) { + if (vm->m_area.contains(p) && vm->m_area.contains(p + v3s16(0, 1, 0)) && + vm->m_area.contains(v3s16(p.X - dir.X, p.Y - 1, p.Z - dir.Z))) { if (make_stairs) { makeFill(p + v3s16(-1, -1, -1), dp.holesize + v3s16(2, 3, 2), |