Commit 2be2b1c
authored
scm_p_require: add missing GC protection for a local variable (#21)
Fixes #20.
Original code, when SCM_COMPAT_SIOD was enabled, allowed the `filename`
object to be freed by GC during the call to `scm_require_internal`,
causing a use-after-free problem. This was caused by the C compiler not
saving the `filename` pointer on the stack across the call.
This patch fixes it by marking `filename` volatile. (I can think of many
ways to fix the problem. I chose `volatile` because it's simple and it's
already used elsewhere in the codebase)1 parent 1040016 commit 2be2b1c
1 file changed
+3
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
242 | | - | |
243 | 241 | | |
244 | 242 | | |
245 | 243 | | |
246 | 244 | | |
247 | | - | |
248 | | - | |
| 245 | + | |
249 | 246 | | |
250 | 247 | | |
251 | | - | |
| 248 | + | |
252 | 249 | | |
253 | 250 | | |
254 | 251 | | |
| |||
0 commit comments