[PATCH] coffcode.h: Fix uninitialized variable.

Christophe Lyon christophe.lyon@st.com
Tue May 15 12:03:00 GMT 2018


Hi,


We hit a problem with cross mingw64-w64 binutils leading to random "multiple defined symbol" errors.

Valgrind helped track this down to uninitialized variable access, which is fixed by the small attached patch, similarly to what was done in PR 17521 for instance.

OK for master? It should probably be applied to release branches too.

Thanks,


Christophe


-------------- next part --------------
2018-05-15  Christophe Guillon  <christophe.guillon@st.com>

	* coffcode.h (coff_bigobj_swap_aux_in): Make sure that all fields
	of the aux structure are initialised.

diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index c63ebd2..6ad991c 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5528,6 +5528,9 @@ coff_bigobj_swap_aux_in (bfd *abfd,
   AUXENT_BIGOBJ *ext = (AUXENT_BIGOBJ *) ext1;
   union internal_auxent *in = (union internal_auxent *) in1;
 
+  /* Make sure that all fields in the aux structure are
+     initialised.  */
+  memset (in, 0, sizeof * in);
   switch (in_class)
     {
     case C_FILE:


More information about the Binutils mailing list