+2020-02-24 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ * collect2.c (tool_cleanup): Avoid calling not signal-safe
+ functions.
+ (maybe_run_lto_and_relink): Avoid possible signal handler
+ access to unintialzed memory (lto_o_files).
+
2020-02-23 Peter Bergner <bergner@linux.ibm.com>
Backport from master
void
tool_cleanup (bool from_signal)
{
+ /* maybe_unlink may call notice, which is not signal safe. */
+ if (from_signal)
+ verbose = false;
+
if (c_file != 0 && c_file[0])
maybe_unlink (c_file);
++num_files;
}
- lto_o_files = XNEWVEC (char *, num_files + 1);
+ /* signal handler may access uninitialized memory
+ and delete whatever it points to, if lto_o_files
+ is not allocated with calloc. */
+ lto_o_files = XCNEWVEC (char *, num_files + 1);
lto_o_files[num_files] = NULL;
start = XOBFINISH (&temporary_obstack, char *);
for (i = 0; i < num_files; ++i)