about summary refs log tree commit diff
path: root/stdlib/cxa_atexit.c
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2018-09-01 10:50:41 -0700
committerPaul Pluzhnikov <ppluzhnikov@google.com>2018-11-30 16:18:34 -0800
commit8e67b39eb4a3abb6f3e35de3ad6e5d06ed0e8498 (patch)
tree32cb45ac608306b882ba1dab40756ea9eafc12d8 /stdlib/cxa_atexit.c
parent15b8d67e29142251a30576b5ab469051a8833e97 (diff)
downloadglibc-8e67b39eb4a3abb6f3e35de3ad6e5d06ed0e8498.tar.gz
glibc-8e67b39eb4a3abb6f3e35de3ad6e5d06ed0e8498.tar.xz
glibc-8e67b39eb4a3abb6f3e35de3ad6e5d06ed0e8498.zip
stdlib: assert on NULL function pointer in atexit etc. [BZ #20544]
Diffstat (limited to 'stdlib/cxa_atexit.c')
-rw-r--r--stdlib/cxa_atexit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/stdlib/cxa_atexit.c b/stdlib/cxa_atexit.c
index 6d65f7e615..37b22d5801 100644
--- a/stdlib/cxa_atexit.c
+++ b/stdlib/cxa_atexit.c
@@ -36,6 +36,10 @@ __internal_atexit (void (*func) (void *), void *arg, void *d,
 {
   struct exit_function *new;
 
+  /* As a QoI issue we detect NULL early with an assertion instead
+     of a SIGSEGV at program exit when the handler is run (bug 20544).  */
+  assert (func != NULL);
+
   __libc_lock_lock (__exit_funcs_lock);
   new = __new_exitfn (listp);