mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-30 13:19:47 +00:00
Kernel: Don't assert on sys$kill() with pid=INT32_MIN
On 32-bit platforms, INT32_MIN == -INT32_MIN, so we can't expect this
to always work:
if (pid < 0)
positive_pid = -pid; // may still be negative!
This happens because the -INT32_MIN expression becomes a long and is
then truncated back to an int.
Fixes #1312.
This commit is contained in:
@@ -2213,8 +2213,11 @@ int Process::sys$kill(pid_t pid, int signal)
|
||||
|
||||
if (signal < 0 || signal >= 32)
|
||||
return -EINVAL;
|
||||
if (pid <= 0)
|
||||
if (pid <= 0) {
|
||||
if (pid == INT32_MIN)
|
||||
return -EINVAL;
|
||||
return do_killpg(-pid, signal);
|
||||
}
|
||||
if (pid == -1) {
|
||||
// FIXME: Send to all processes.
|
||||
return -ENOTIMPL;
|
||||
|
||||
Reference in New Issue
Block a user