]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't underflow datagram_address array
authorDaniel Colascione <dancol@dancol.org>
Sun, 23 Mar 2014 05:15:48 +0000 (22:15 -0700)
committerDaniel Colascione <dancol@dancol.org>
Sun, 23 Mar 2014 05:15:48 +0000 (22:15 -0700)
src/ChangeLog
src/process.c

index efb96ce8494125ede4ecaaf8780d9c475602d073..36964f5743740404f0bc9edb89ca4bb84f19fd72 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-23  Daniel Colascione  <dancol@dancol.org>
+
+       * process.c (DATAGRAM_CONN_P): Don't underflow datagram_address
+       array.  (ASAN caught.)
+
 2014-03-22  Glenn Morris  <rgm@gnu.org>
 
        * callproc.c (init_callproc): In etc, look for NEWS rather than GNU.
index 10a2984a05358d03a1d6db9801abe0c09a048328..fd34eb08d9d583962d7dd36a1ff47969d3081f09 100644 (file)
@@ -353,7 +353,10 @@ static struct sockaddr_and_len {
   int len;
 } datagram_address[FD_SETSIZE];
 #define DATAGRAM_CHAN_P(chan)  (datagram_address[chan].sa != 0)
-#define DATAGRAM_CONN_P(proc)  (PROCESSP (proc) && datagram_address[XPROCESS (proc)->infd].sa != 0)
+#define DATAGRAM_CONN_P(proc)                                           \
+  (PROCESSP (proc) &&                                                   \
+   XPROCESS (proc)->infd >= 0 &&                                        \
+   datagram_address[XPROCESS (proc)->infd].sa != 0)
 #else
 #define DATAGRAM_CHAN_P(chan)  (0)
 #define DATAGRAM_CONN_P(proc)  (0)