diff options
| author | Frédéric Desbiens <[email protected]> | 2026-08-16 18:24:25 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-08-16 18:24:25 -0400 |
| commit | 3501c5c31d9945b77649fec94382821f50d6148e (patch) | |
| tree | aff2c4e520b1cdf19d83df886b55d327b0cdbfa2 /common_modules/module_lib/src/txm_module_application_request.c | |
| parent | 2f378a4c8e934b1694adb93cd666318455115b9f (diff) | |
Stopped two POSIX call sites falling through their error handler (#625)
posix_internal_error() never comes back for a non-zero code: its body is
"while (error_code) { ; }". Most callers in the layer still follow it with an
explicit error return. Two do not, and both fall through into a pointer
dereference, so they are only correct because the handler happens to hang.
That is a fragile thing to rely on. The C standard permits an implementation to
assume a loop with no side effects terminates (C11 6.8.5p6), so the guarantee is
a property of the toolchain rather than of the language. Both toolchains the
project supports do preserve the loop today - checked with GCC 14.3 at -O0, -O1,
-O2 and -Os, and with Clang 22 at -O0 and -O2 - so nothing is broken right now.
Neither call site should depend on that.
mq_send() falls through with bp indeterminate, having just been told the
allocation failed, and would copy msg_len bytes through it. Report ENOMEM and
return ERROR instead.
posix_thread2tid() falls through with thread_ptr NULL. posix_thread2tcb() returns
NULL for that input, and the next line reads p_tcb->pthreadID. Return zero, which
is never a valid pthread ID because px_pth_create.c assigns the address of the
TCB as the ID.
No behaviour changes while the handler keeps hanging; both additions are
unreachable today.
Assisted-by: Claude Code (Opus 5) <[email protected]>
Diffstat (limited to 'common_modules/module_lib/src/txm_module_application_request.c')
0 files changed, 0 insertions, 0 deletions
