Hi. The patch is fixing an issue reported with clang-static-analyzer.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests. I'm going to install the patch tomorrow if there are no objections. Thanks, Martin libgcc/ChangeLog: 2019-06-24 Martin Liska <mli...@suse.cz> * libgcov-driver-system.c (replace_filename_variables): Do not call strlen with NULL argument. --- libgcc/libgcov-driver-system.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libgcc/libgcov-driver-system.c b/libgcc/libgcov-driver-system.c index b5f3e89ebdc..39dc62749d5 100644 --- a/libgcc/libgcov-driver-system.c +++ b/libgcc/libgcov-driver-system.c @@ -186,13 +186,14 @@ replace_filename_variables (char *filename) /* Concat beginning of the path, replacement and ending of the path. */ unsigned end = length - (p - filename); - unsigned repl_length = strlen (replacement); + unsigned repl_length = replacement != NULL ? strlen (replacement) : 0; char *buffer = (char *)xmalloc (start + end + repl_length + 1); char *buffer_ptr = buffer; buffer_ptr = (char *)memcpy (buffer_ptr, filename, start); buffer_ptr += start; - buffer_ptr = (char *)memcpy (buffer_ptr, replacement, repl_length); + if (replacement != NULL) + buffer_ptr = (char *)memcpy (buffer_ptr, replacement, repl_length); buffer_ptr += repl_length; buffer_ptr = (char *)memcpy (buffer_ptr, p, end); buffer_ptr += end;