Commit ee1b796
authored
bugfix: Use after free in fs.cpp's watch method (#568)
This use after free manifested intermittently when running lots and lots
of tests at a time in this PR:
#557.
The cause of this uaf happens because we do not close the `fs_event_t`
handle. When the `WatchHandle` wrapper gets closed, it invoked
`uv_event_stop` but not `uv_close`, so the memory associated with the
handle gets freed, but `libuv` doesn't know that this handle is closed.
This causes uv's internal data structures to get messed up and we may
accidentally touch this freed memory causing the Use-After-Free.
`WatchHandle::close` already invokes `uv_event_stop`, so we can remove
this from the implementation of `closeHandle`.1 parent 98807fa commit ee1b796
1 file changed
+2
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
561 | 561 | | |
562 | 562 | | |
563 | 563 | | |
| 564 | + | |
| 565 | + | |
564 | 566 | | |
565 | 567 | | |
566 | 568 | | |
| |||
586 | 588 | | |
587 | 589 | | |
588 | 590 | | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | 591 | | |
596 | 592 | | |
597 | 593 | | |
| |||
0 commit comments