mirror of
https://github.com/brl/mutter.git
synced 2024-12-22 11:02:05 +00: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
98a0c5cb35
commit
33c008b90a
@ -2604,6 +2604,9 @@ clutter_actor_set_allocation_internal (ClutterActor *self,
|
||||
gboolean retval;
|
||||
ClutterActorBox old_alloc = { 0, };
|
||||
|
||||
g_return_val_if_fail (!isnan (box->x1) && !isnan (box->x2) &&
|
||||
!isnan (box->y1) && !isnan (box->y2), FALSE);
|
||||
|
||||
obj = G_OBJECT (self);
|
||||
|
||||
g_object_freeze_notify (obj);
|
||||
@ -10366,6 +10369,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