[forwarded from http://bugs.debian.org/336511] bug submitter writes: If mudflap is used to instrument a program using dlopen, and the program (assuming it is compiled with -rdynamic) loads itself by passing NULL for the path to dlopen, the program will crash unconditionally; that is, regardless of the options passed to mudflap, so long as instrumentation is enabled. This is because (at least with GNU/Linux) it is valid to pass a NULL pointer as the path argument to dlopen, and the instrumentation code unconditionally uses strlen on that pointer, without checking first if it is NULL. I have included the following patch, which may help fix the problem. I have not tested it, but it should work. As always, it is "as is", with no warranty of any kind. The patch is against svn HEAD (r104588). - --- mf-hooks2.c.orig 2005-10-30 20:35:44.000000000 +0000 +++ mf-hooks2.c 2005-10-30 20:37:38.000000000 +0000 @@ -1679,8 +1679,10 @@ WRAPPER2(void *, dlopen, const char *pat void *p; size_t n; TRACE ("%s\n", __PRETTY_FUNCTION__); - - n = strlen (path); - - MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "dlopen path"); + if (NULL != path) { + n = strlen (path); + MF_VALIDATE_EXTENT (path, CLAMPADD(n, 1), __MF_CHECK_READ, "dlopen path"); + } p = dlopen (path, flags); if (NULL != p) { #ifdef MF_REGISTER_dlopen
I think this is a GNU extension or one which came in from elf.
Confirmed.
(test only, please ignore)
fmudflap support has been removed.