diff options
| author | Basil L. Contovounesios | 2018-10-25 03:35:57 +0100 |
|---|---|---|
| committer | Eli Zaretskii | 2018-11-03 10:46:01 +0200 |
| commit | bd1d61753d90ef47af1e9a3b7a92ee77b7d43ed0 (patch) | |
| tree | 033ef2714165db6fc3bcfc3f62e0e68682b278bb | |
| parent | 88ef31abd4716fad14889b08686d42ebbb7dc6c0 (diff) | |
| download | emacs-bd1d61753d90ef47af1e9a3b7a92ee77b7d43ed0.tar.gz emacs-bd1d61753d90ef47af1e9a3b7a92ee77b7d43ed0.zip | |
Avoid race in rcirc process filter (bug#33145)
* lisp/net/rcirc.el (rcirc-filter): Clear rcirc-process-output
before processing its constituent lines. Otherwise, if rcirc-filter
runs again before the last rcirc-process-server-response is
finished, the contents of rcirc-process-output could be duplicated.
| -rw-r--r-- | lisp/net/rcirc.el | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index c09bff765b2..f57f7555c32 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el | |||
| @@ -753,12 +753,12 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.") | |||
| 753 | (with-rcirc-process-buffer process | 753 | (with-rcirc-process-buffer process |
| 754 | (setq rcirc-last-server-message-time (current-time)) | 754 | (setq rcirc-last-server-message-time (current-time)) |
| 755 | (setq rcirc-process-output (concat rcirc-process-output output)) | 755 | (setq rcirc-process-output (concat rcirc-process-output output)) |
| 756 | (when (= (aref rcirc-process-output | 756 | (when (= ?\n (aref rcirc-process-output |
| 757 | (1- (length rcirc-process-output))) ?\n) | 757 | (1- (length rcirc-process-output)))) |
| 758 | (mapc (lambda (line) | 758 | (let ((lines (split-string rcirc-process-output "[\n\r]" t))) |
| 759 | (rcirc-process-server-response process line)) | 759 | (setq rcirc-process-output nil) |
| 760 | (split-string rcirc-process-output "[\n\r]" t)) | 760 | (dolist (line lines) |
| 761 | (setq rcirc-process-output nil)))) | 761 | (rcirc-process-server-response process line)))))) |
| 762 | 762 | ||
| 763 | (defun rcirc-reschedule-timeout (process) | 763 | (defun rcirc-reschedule-timeout (process) |
| 764 | (with-rcirc-process-buffer process | 764 | (with-rcirc-process-buffer process |