Add bound checking to Simulation::clear_area
Fixes a crash easily reproducible with sim.clearRect(-10000000, -10000000, 20000000, 20000000)
This commit is contained in:
parent
b2045c067e
commit
04b8378de4
@ -85,6 +85,11 @@ void Simulation::Restore(const Snapshot &snap)
|
||||
|
||||
void Simulation::clear_area(int area_x, int area_y, int area_w, int area_h)
|
||||
{
|
||||
auto intersection = RES.OriginRect() & RectSized(Vec2{ area_x, area_y }, Vec2{ area_w, area_h });
|
||||
area_x = intersection.TopLeft.X;
|
||||
area_y = intersection.TopLeft.Y;
|
||||
area_w = intersection.Size().X;
|
||||
area_h = intersection.Size().Y;
|
||||
float fx = area_x-.5f, fy = area_y-.5f;
|
||||
for (int i = 0; i <= parts_lastActiveIndex; i++)
|
||||
{
|
||||
|
Reference in New Issue
Block a user