Commit e992a34
zlib: fix use-after-free when reset() is called during write
The Reset() method did not check the write_in_progress_ flag before
resetting the compression stream. This allowed reset() to free the
compression library's internal state while a worker thread was still
using it during an async write, causing a use-after-free.
Add a write_in_progress_ guard to Reset() that throws an error if a
write is in progress, matching the existing pattern used by Close()
and Write().
PR-URL: TODO
Refs: https://hackerone.com/reports/3609132
PR-URL: #62325
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>1 parent 1cdd23c commit e992a34Copy full SHA for e992a34
2 files changed
+29Lines changed: 29 additions & 0 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- src
- test/parallel
Expand file treeCollapse file tree
Open diff view settings
Collapse file
+6Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
644 | 644 | |
645 | 645 | |
646 | 646 | |
| 647 | + |
| 648 | + |
| 649 | + |
| 650 | + |
| 651 | + |
| 652 | + |
647 | 653 | |
648 | 654 | |
649 | 655 | |
|
Collapse file
test/parallel/test-zlib-reset-during-write.js
Copy file name to clipboard+23Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
0 commit comments