1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2026-01-15 07:21:00 +00:00
serenity/Userland/Libraries/LibC/sys
Daniel Bertalan 78e7ff008b LibC: Fix negation overflow UB in sys/mman.cpp
When the system calls return `NumericLimits<ptrdiff_t>::min()`, negating
the return code would produce `NumericLimits<ptrdiff_t>::max() + 1`
since we are on a two's complement architecture. Because this value
cannot be stored, signed overflow occurs which is UB. This can be fixed
by applying the negation to `EMAXERRNO` since that's known to contain a
relatively small value.

Found when running tests with Clang.
2021-08-08 10:55:36 +02:00
..
arch HackStudio: Enable building HackStudio on x86_64 2021-08-02 00:57:06 +02:00
cdefs.h
file.cpp LibC: Implement flock(2) using fcntl's F_SETLK 2021-07-20 17:44:30 +04:30
file.h LibC: Implement flock(2) using fcntl's F_SETLK 2021-07-20 17:44:30 +04:30
internals.h
ioctl.h
ioctl_numbers.h Kernel: Add option to build with coverage instrumentation and KCOV 2021-07-26 17:40:28 +02:00
kcov.h Kernel: Add option to build with coverage instrumentation and KCOV 2021-07-26 17:40:28 +02:00
mman.cpp LibC: Fix negation overflow UB in sys/mman.cpp 2021-08-08 10:55:36 +02:00
mman.h LibC: Stub mlock in sys/mman 2021-07-30 20:49:56 +02:00
param.h
prctl.cpp
prctl.h
prctl_numbers.h
ptrace.cpp
ptrace.h
resource.h
select.cpp
select.h
socket.cpp
socket.h Kernel+LibC: Add linger to sys/sockets.h 2021-07-29 19:35:03 +01:00
stat.h
statvfs.cpp
statvfs.h
sysmacros.h
time.h
times.h
ttydefaults.h
types.h
uio.cpp
uio.h
un.h
utsname.h
wait.cpp
wait.h