Commit 3ada6ee
fix: updateStatus captured a full *StatusBar in a pending idle callback (theoretical UAF)
Flagged by the GTK crash-hunt investigation, not reproduced but real: of
StatusBar's five g_idle_add-based update methods, updateStatus was the
only one capturing self_ptr: *StatusBar and dereferencing the whole struct
from inside the callback — if StatusBar.deinit() ran while the callback
was still queued (idle callbacks aren't guaranteed to run before the next
main-loop iteration), that's a real use-after-free. The other four
methods (updateProgress/pulseProgress/updateVoice/updateEngine) already
capture only the specific widget pointers + allocator they need, which
survive freeing the StatusBar struct itself just fine — made updateStatus
match that existing, safer pattern instead of introducing new tracking
machinery.
The narrower "GTK widget itself destroyed before the idle callback fires"
risk (present in all five methods equally, not just updateStatus) is a
different, harder problem needing weak-pointer tracking on the widgets —
left as documented backlog, not fixed here, matching the low-priority/
unreproduced assessment this was originally flagged with.
Verified: full test suite passes (46/47, 1 pre-existing unrelated skip),
smoke-tested a real run with no new warnings/crashes.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 92ae391 commit 3ada6ee
1 file changed
Lines changed: 28 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
105 | 115 | | |
106 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
107 | 119 | | |
108 | 120 | | |
109 | 121 | | |
110 | 122 | | |
111 | | - | |
112 | 123 | | |
113 | 124 | | |
114 | 125 | | |
115 | 126 | | |
116 | 127 | | |
117 | 128 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
121 | 132 | | |
122 | 133 | | |
123 | | - | |
| 134 | + | |
124 | 135 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
129 | 139 | | |
130 | 140 | | |
131 | 141 | | |
132 | | - | |
133 | | - | |
| 142 | + | |
| 143 | + | |
134 | 144 | | |
135 | | - | |
136 | | - | |
137 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
138 | 148 | | |
139 | 149 | | |
140 | 150 | | |
| |||
145 | 155 | | |
146 | 156 | | |
147 | 157 | | |
148 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
149 | 161 | | |
150 | 162 | | |
151 | 163 | | |
| |||
0 commit comments