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

Aperta
#14,137 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 8 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
desktop

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
JavaScript
Stelle
5.7k
Fork
941
Merge medio
7g 9h
PR unite (30g)
13

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di linuxmint/cinnamon

Tutte le issue di linuxmint/cinnamon

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.