mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
clutter/actor: Sanity check new allocations
Apparently some shell extensions are setting invalid NaN allocations, leading to weird crashes like https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1849. Even though an implementation error like this probably deserves a crash, those can be hard to debug since the crash can happen anywhere the allocation is being used later. So let Clutter be the good guy and prevent implementations from setting invalid allocations by sanity-checking the ClutterActorBoxes using g_return_if_fail. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1849 https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1280
This commit is contained in:
parent
59a2bff8e2
commit
dcb42d3b25
@ -2601,6 +2601,9 @@ clutter_actor_set_allocation_internal (ClutterActor *self,
|
||||
gboolean x1_changed, y1_changed, x2_changed, y2_changed;
|
||||
ClutterActorBox old_alloc = { 0, };
|
||||
|
||||
g_return_if_fail (!isnan (box->x1) && !isnan (box->x2) &&
|
||||
!isnan (box->y1) && !isnan (box->y2));
|
||||
|
||||
obj = G_OBJECT (self);
|
||||
|
||||
g_object_freeze_notify (obj);
|
||||
@ -10149,6 +10152,11 @@ clutter_actor_allocate (ClutterActor *self,
|
||||
old_allocation = priv->allocation;
|
||||
real_allocation = *box;
|
||||
|
||||
g_return_if_fail (!isnan (real_allocation.x1) &&
|
||||
!isnan (real_allocation.x2) &&
|
||||
!isnan (real_allocation.y1) &&
|
||||
!isnan (real_allocation.y2));
|
||||
|
||||
/* constraints are allowed to modify the allocation only here; we do
|
||||
* this prior to all the other checks so that we can bail out if the
|
||||
* allocation did not change
|
||||
|
Loading…
Reference in New Issue
Block a user