Commit d83cf4cc authored by Paul Eggert's avatar Paul Eggert

* process.c (Fsignal_process): Check for process-ids out of pid_t range rather...

* process.c (Fsignal_process): Check for process-ids out of pid_t range rather than relying on undefined behavior.
parent 3f4eabd1
...@@ -562,8 +562,8 @@ ...@@ -562,8 +562,8 @@
(sigchld_handler): (sigchld_handler):
Check that fixnums are in proper range for system types. Check that fixnums are in proper range for system types.
(Fsignal_process): Simplify by avoiding a goto. (Fsignal_process): Simplify by avoiding a goto.
Treat out-of-range process numbers just like invalid numbers Check for process-ids out of pid_t range rather than relying on
that fit into the pid_t range, and return -1. undefined behavior.
(Fformat_network_address, read_process_output, send_process) (Fformat_network_address, read_process_output, send_process)
(Fprocess_send_region, status_notify): (Fprocess_send_region, status_notify):
Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
......
...@@ -5976,22 +5976,8 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) ...@@ -5976,22 +5976,8 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
if (NILP (process)) if (NILP (process))
return process; return process;
if (INTEGERP (process)) if (NUMBERP (process))
{ CONS_TO_INTEGER (process, pid_t, pid);
EMACS_INT v = XINT (process);
if (! (TYPE_MINIMUM (pid_t) <= v && v <= TYPE_MAXIMUM (pid_t)))
return make_number (-1);
pid = v;
}
else if (FLOATP (process))
{
double v = XFLOAT_DATA (process);
if (! (TYPE_MINIMUM (pid_t) <= v && v < TYPE_MAXIMUM (pid_t) + 1.0))
return make_number (-1);
pid = v;
if (pid != v)
return make_number (-1);
}
else else
{ {
CHECK_PROCESS (process); CHECK_PROCESS (process);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment