[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-28 8a07343: Avoid undefined behavior in 'send-process-region' (Bug

From: Philipp Stephani
Subject: emacs-28 8a07343: Avoid undefined behavior in 'send-process-region' (Bug#52369).
Date: Sat, 11 Dec 2021 13:25:49 -0500 (EST)

branch: emacs-28
commit 8a0734329a4faf0b45627763af74222bdd0ec143
Author: Philipp Stephani <phst@google.com>
Commit: Philipp Stephani <phst@google.com>

    Avoid undefined behavior in 'send-process-region' (Bug#52369).
    * src/process.c (send_process): Signal an error if the file descriptor
    has already been closed.
 src/process.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/process.c b/src/process.c
index 75ba191..1d307d5 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6520,6 +6520,9 @@ send_process (Lisp_Object proc, const char *buf, 
ptrdiff_t len,
          /* Send this batch, using one or more write calls.  */
          ptrdiff_t written = 0;
          int outfd = p->outfd;
+          if (outfd < 0)
+            error ("Output file descriptor of %s is closed",
+                   SDATA (p->name));
          eassert (0 <= outfd && outfd < FD_SETSIZE);
          if (DATAGRAM_CHAN_P (outfd))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]