1 Star 0 Fork 23

zhangxingrong/mutter

forked from src-openEuler/mutter 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Do-not-write-uninitialized-out-values-on-failed-transform.patch 1.71 KB
一键复制 编辑 原始数据 按行查看 历史
zhangxingrong 提交于 2024-07-31 17:51 . add some upstream patchs
From fa10ce76db0da6ba812badcbfefc007fb08c400c Mon Sep 17 00:00:00 2001
From: Sebastian Keller <skeller@gnome.org>
Date: Fri, 15 Dec 2023 00:47:34 +0100
Subject: [PATCH] clutter/actor: Don't write uninitialized out values on failed
transform
clutter_actor_get_transformed_position() would write the uninitialized
values of v2 when clutter_actor_apply_transform_to_point() fails in
_clutter_actor_fully_transform_vertices() because the actor has not been
added to the stage yet.
When called from JS this would overwrite the zero initialized values
passed in from gjs. If the uninitialized values now happen to correspond
to one of the NaN float values used by mozjs to represent a pointer
type, this would lead to seemingly random crashes in mozjs code later
on.
Avoid this by using _clutter_actor_fully_transform_vertices() directly,
which allows us to check if it failed.
Related: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/469
Related: https://gitlab.gnome.org/GNOME/gjs/-/issues/591
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3453>
(cherry picked from commit c86d8a23c3464f75b976af915f0926b5dfc10241)
---
clutter/clutter/clutter-actor.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index cac1da4dee..0e87cc8734 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -9668,7 +9668,9 @@ clutter_actor_get_transformed_position (ClutterActor *self,
graphene_point3d_t v2;
v1.x = v1.y = v1.z = 0;
- clutter_actor_apply_transform_to_point (self, &v1, &v2);
+
+ if (!_clutter_actor_fully_transform_vertices (self, &v1, &v2, 1))
+ return;
if (x)
*x = v2.x;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangxingrong/mutter.git
git@gitee.com:zhangxingrong/mutter.git
zhangxingrong
mutter
mutter
master

搜索帮助