aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTreer <treer.git@gmail.com>2021-08-17 01:55:35 +1000
committerGitHub <noreply@github.com>2021-08-16 17:55:35 +0200
commit963fbd1572e805ae5205381ba6cb372699d6bd30 (patch)
tree827146e942740f3aa3d2723cc0a483f899cb2c29 /src
parentb3b075ea02034306256b486dd45410aa765f035a (diff)
downloadminetest-963fbd1572e805ae5205381ba6cb372699d6bd30.tar.gz
minetest-963fbd1572e805ae5205381ba6cb372699d6bd30.tar.bz2
minetest-963fbd1572e805ae5205381ba6cb372699d6bd30.zip
Fix access violation in create_schematic() (#11534)
fixes #11533 Schematics saved from y locations greater than 0 would cause an access violation if layer probabilities were specified
Diffstat (limited to 'src')
-rw-r--r--src/mapgen/mg_schematic.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mapgen/mg_schematic.cpp b/src/mapgen/mg_schematic.cpp
index 653bad4fe..848a43626 100644
--- a/src/mapgen/mg_schematic.cpp
+++ b/src/mapgen/mg_schematic.cpp
@@ -598,8 +598,9 @@ void Schematic::applyProbabilities(v3s16 p0,
}
for (size_t i = 0; i != splist->size(); i++) {
- s16 y = (*splist)[i].first - p0.Y;
- slice_probs[y] = (*splist)[i].second;
+ s16 slice = (*splist)[i].first;
+ if (slice < size.Y)
+ slice_probs[slice] = (*splist)[i].second;
}
}