Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-08 04:20:06 +01:00
Avoid int overflow when using fillr in negative coords (#1711)
Fix int overflow when using fill and fillr in negative y-coordinates
Dieser Commit ist enthalten in:
Ursprung
198c6b7800
Commit
32231b48fe
@ -1459,10 +1459,17 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
checkArgument(radius >= 0, "radius >= 0");
|
checkArgument(radius >= 0, "radius >= 0");
|
||||||
checkArgument(depth >= 1, "depth >= 1");
|
checkArgument(depth >= 1, "depth >= 1");
|
||||||
|
|
||||||
|
// Avoid int overflow (negative coordinate space allows for overflow back round to positive if the depth is large enough).
|
||||||
|
// Depth is always 1 or greater, thus the lower bound should always be <= origin y.
|
||||||
|
int lowerBound = origin.getBlockY() - depth + 1;
|
||||||
|
if (lowerBound > origin.getBlockY()) {
|
||||||
|
lowerBound = Integer.MIN_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
Mask mask = new MaskIntersection(
|
Mask mask = new MaskIntersection(
|
||||||
new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
|
new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))),
|
||||||
new BoundedHeightMask(
|
new BoundedHeightMask(
|
||||||
Math.max(origin.getBlockY() - depth + 1, minY),
|
Math.max(lowerBound, minY),
|
||||||
Math.min(maxY, origin.getBlockY())
|
Math.min(maxY, origin.getBlockY())
|
||||||
),
|
),
|
||||||
Masks.negate(new ExistingBlockMask(this))
|
Masks.negate(new ExistingBlockMask(this))
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren