Commit 07f5a88
libnemo-private: fix use-after-free crash in nemo_file_mark_gone (#3724)
nemo_directory_remove_file() calls nemo_file_unref() when the directory
is monitoring its file list. If the caller holds no extra ref, this can
drop the refcount to zero and free the NemoFile object. The
nemo_file_clear_info() call immediately after then dereferences the
freed pointer, causing a SIGSEGV.
Fix: take a temporary ref before the if-block so the object stays alive
through both nemo_directory_remove_file() and nemo_file_clear_info(),
and release it only after both calls complete.
Closes #3712
Co-authored-by: smpl-os <[email protected]>1 parent f0cec39 commit 07f5a88
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7947 | 7947 | | |
7948 | 7948 | | |
7949 | 7949 | | |
| 7950 | + | |
| 7951 | + | |
| 7952 | + | |
| 7953 | + | |
| 7954 | + | |
| 7955 | + | |
7950 | 7956 | | |
7951 | 7957 | | |
7952 | 7958 | | |
7953 | 7959 | | |
7954 | 7960 | | |
| 7961 | + | |
7955 | 7962 | | |
7956 | 7963 | | |
7957 | 7964 | | |
| |||
0 commit comments