]> git.eshelyaron.com Git - emacs.git/commitdiff
Backport memory fix (2014-03-23T05:15:48Z!dancol@dancol.org) from trunk
authorDaniel Colascione <dancol@dancol.org>
Sun, 23 Mar 2014 06:05:54 +0000 (23:05 -0700)
committerDaniel Colascione <dancol@dancol.org>
Sun, 23 Mar 2014 06:05:54 +0000 (23:05 -0700)
src/ChangeLog
src/process.c

index dbfb1436fe13d73cd422588b436955b453164351..48fc2262e924cae8a77610e5169f1453e5142195 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-21  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
        Fix regression introduced by patch for Bug#10500.
index 187627dd85ab725c9a85905f3009efefdc7d4b71..6f89408b5ee278c081dce71b9820c3ca1b868ef7 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)