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

オープン
#14,137 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 8 日以内に返信

まだ誰も着手していません。

評価

難易度
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
平均マージ
7日 9時間
マージ済み PR(30日)
13

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

linuxmint/cinnamon のほかの issue

linuxmint/cinnamon の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。