[email protected]: empty pseudo class from format_timespan() causes heap over-read in St find_class_name() and crashes Cinnamon

未关闭
#14,137 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 8 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript
领域
desktop

调研方向

Start with files/usr/share/cinnamon/applets/[email protected]/eventView.js and trace how format_timespan()'s pseudo class reaches update_variations(). Then inspect src/st/st-widget.c, especially find_class_name(), and the attached reproduction details. Confirm the fix prevents the crash for events starting 60 minutes or more later today while preserving their countdown text.

由索引模型根据 Issue 内容生成。

描述

BUG
Distribution

NixOS 26.05

Package version

6.6.8

Graphics hardware in use

not relevant

Frequency

Only occasionally

Bug description

Cinnamon sometimes segfaults right after login, or when the calendar server updates events. Then the "fallback mode / restart Cinnamon?" dialog appears. It only happens when there are calendar events, and it happens at random.

01-bug-description.md

Steps to reproduce

In Cinnamon (random, depends on heap layout):

  1. Have a calendar with an event today that starts 60 minutes or more from now, so it shows in the calendar applet.
  2. Log in, or wait for the calendar server to send an event update.
  3. Sometimes Cinnamon segfaults with the stack trace above.

02-steps-to-reproduce.md

Expected behavior

Cinnamon does not crash. An event that starts later today shows its countdown text ("In 2 hours", "Starting later today", …) without adding a pseudo class.

Additional information
Cause
  1. format_timespan() in files/usr/share/cinnamon/applets/[email protected]/eventView.js returns "" as the pseudo class for events that start today 60 minutes or more from now (return ["", ...]).
  2. update_variations() passes it on unconditionally:
  3. countdown_label is the last child of label_box. st_widget_last_child_notify() has already given it the pseudo class last-child, so class_list is not empty.
  4. In src/st/st-widget.c, find_class_name() loops with strstr (match + 1, class_name). With class_name == "", strstr never returns NULL. For class_list = "last-child" no position meets the conditions, so the loop steps past the terminating NUL and keeps reading heap memory. It stops either when some bytes happen to match (no crash, but a bogus "found" result) or when it reaches an unmapped page (segfault). This is why the crash is random.

04-additional-information.md

主要语言
JavaScript
星标
5.7k
派生
941
平均合并
6 天 18 小时
30 天内合并 PR
12

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

linuxmint/cinnamon 的其他 Issue

查看 linuxmint/cinnamon 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。