unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Fabrice Bauzac <fabrice.bauzac@wanadoo.fr>
Subject: Re: Repeatable bug since src/process.c v1.403
Date: Sun, 18 May 2003 16:15:22 +0200	[thread overview]
Message-ID: <E19HOwc-0005oA-00@noon.dnsalias.net> (raw)

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	other threads:[~2003-05-18 14:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-18 14:15 Fabrice Bauzac [this message]
     [not found] <mailman.6345.1053196441.21513.bug-gnu-emacs@gnu.org>
2003-05-17 20:07 ` Repeatable bug since src/process.c v1.403 David Kastrup
  -- strict thread matches above, loose matches on Subject: below --
2003-05-17 18:33 Fabrice Bauzac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E19HOwc-0005oA-00@noon.dnsalias.net \
    --to=fabrice.bauzac@wanadoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).