# HG changeset patch # User reimar # Date 1188025729 0 # Node ID a659694f00bc4c3beda37ecb69d7950dc9942293 # Parent 84bc662dc979c1b129ea1a556f753bd264fb5b83 HACK: check added fds for validity because otherwise mplayer crashes due to using FD_SET on -1 diff -r 84bc662dc979 -r a659694f00bc input/input.c --- a/input/input.c Sat Aug 25 06:52:17 2007 +0000 +++ b/input/input.c Sat Aug 25 07:08:49 2007 +0000 @@ -600,6 +600,10 @@ mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyCmdFds,fd); return 0; } + if (fd < 0) { + mp_msg(MSGT_INPUT, MSGL_ERR, "Invalid fd %i in mp_input_add_cmd_fd", fd); + return 0; + } memset(&cmd_fds[num_cmd_fd],0,sizeof(mp_input_fd_t)); cmd_fds[num_cmd_fd].fd = fd; @@ -655,6 +659,10 @@ mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyKeyFds,fd); return 0; } + if (fd < 0) { + mp_msg(MSGT_INPUT, MSGL_ERR, "Invalid fd %i in mp_input_add_key_fd", fd); + return 0; + } memset(&key_fds[num_key_fd],0,sizeof(mp_input_fd_t)); key_fds[num_key_fd].fd = fd; @@ -673,6 +681,10 @@ mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyKeyFds,fd); return 0; } + if (fd < 0) { + mp_msg(MSGT_INPUT, MSGL_ERR, "Invalid fd %i in mp_input_add_event_fd", fd); + return 0; + } memset(&key_fds[num_key_fd],0,sizeof(mp_input_fd_t)); key_fds[num_key_fd].fd = fd;