Subject: bug#24325: 25.1; Crash - fd larger than FD_SETSIZE

From: Eli Zaretskii <[email-masked]>
Date: Sun, 28 Aug 2016 20:53:24 +0300

> From: Robin Campbell Joy <[email-masked]>
> Date: Sun, 28 Aug 2016 11:25:39 +0200
> 
> After a short time emacs is crashing while trying to communicate with an
> external process.
> 
> In the debugger I can see that the fd is larger than FD_SETSIZE. The fd
> is used in process.c:7168-7177 (setup_process_coding_system) to index
> into proc_decode_coding_system which is of size FD_SETSIZE and is
> crashing at process.c:5708 when dereferencing coding->id.

Do you really have several hundreds of subprocesses and/or network
connections active in that session?  If not, how come all the
descriptors below 1024 are in use?

I also don't understand how this:

> #0 0x00000000004942a4 in setup_coding_system (coding_system=4602512, coding=0xffffffffffffffff) at
> coding.c:5706
> eol_type = <optimized out>
          ^^^^^^^^^^^^
Can happen in a build that claims to use 'CFLAGS=-ggdb3 -O0'.  Did you
report the bug from the same binary that crashes?

I guess we will have to refuse to handle a process if its infd and
outfd are at or above FD_SETSIZE, like we do on MS-Windows?