bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Repeatable bug since src/process.c v1.403


From: Fabrice Bauzac
Subject: Re: Repeatable bug since src/process.c v1.403
Date: Sun, 18 May 2003 16:15:22 +0200

Hello,

Note: I'm not on the bug-gnu-emacs mailing-list at the moment: please
CC.

I changed the alloca line in process.c, and the test doesn't crash
Emacs:

Excerpt of process.c
================================================================
#ifdef DATAGRAM_SOCKETS
  /* A datagram is one packet; allow at least 1500+ bytes of data
     corresponding to the typical Ethernet frame size.  */
  if (DATAGRAM_CHAN_P (channel))
    {
      /* carryover = 0; */  /* Does carryover make sense for datagrams? */
      readmax += 1024;
    }
#endif

/*   chars = (char *) alloca (carryover + readmax); */
  chars = (char *) alloca (readmax);
  if (carryover)
    /* See the comment above.  */
    bcopy (SDATA (p->decoding_buf), chars, carryover);

#ifdef DATAGRAM_SOCKETS
  /* We have a working select, so proc_buffered_char is always -1.  */
  if (DATAGRAM_CHAN_P (channel))
    {
      int len = datagram_address[channel].len;
      nbytes = recvfrom (channel, chars + carryover, readmax - carryover,
                         0, datagram_address[channel].sa, &len);
    }
  else
#endif
  if (proc_buffered_char[channel] < 0)
    nbytes = emacs_read (channel, chars + carryover, readmax - carryover);
  else
    {
      chars[carryover] = proc_buffered_char[channel];
      proc_buffered_char[channel] = -1;
      nbytes = emacs_read (channel, chars + carryover + 1,  readmax - 1 - 
carryover);
      if (nbytes < 0)
        nbytes = 1;
      else
        nbytes = nbytes + 1;
    }
#endif /* not VMS */
================================================================

I then un-reverted the 1.403 patch and it crashed:

Excerpt of process.c
================================================================
#ifdef DATAGRAM_SOCKETS
  /* A datagram is one packet; allow at least 1500+ bytes of data
     corresponding to the typical Ethernet frame size.  */
  if (DATAGRAM_CHAN_P (channel))
    {
      /* carryover = 0; */  /* Does carryover make sense for datagrams? */
      readmax += 1024;
    }
#endif

/*   chars = (char *) alloca (carryover + readmax); */
  chars = (char *) alloca (readmax);
  if (carryover)
    /* See the comment above.  */
    bcopy (SDATA (p->decoding_buf), chars, carryover);

#ifdef DATAGRAM_SOCKETS
  /* We have a working select, so proc_buffered_char is always -1.  */
  if (DATAGRAM_CHAN_P (channel))
    {
      int len = datagram_address[channel].len;
      nbytes = recvfrom (channel, chars + carryover, readmax,
                         0, datagram_address[channel].sa, &len);
    }
  else
#endif
  if (proc_buffered_char[channel] < 0)
    nbytes = emacs_read (channel, chars + carryover, readmax);
  else
    {
      chars[carryover] = proc_buffered_char[channel];
      proc_buffered_char[channel] = -1;
      nbytes = emacs_read (channel, chars + carryover + 1,  readmax - 1);
      if (nbytes < 0)
        nbytes = 1;
      else
        nbytes = nbytes + 1;
    }
#endif /* not VMS */
================================================================

Hope this helps.  Tell me if I can do anything else.

-- 
fabrice bauzac
Software should be free.  http://www.gnu.org/philosophy/why-free.html




reply via email to

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