coffcode.h: Fix uninitialized variable.

Message ID 5c282dd9-2a0c-5abc-6f13-4f5dcc8f0c1d@st.com
State New
Headers show
Series
  • coffcode.h: Fix uninitialized variable.
Related show

Commit Message

Christophe Lyon May 15, 2018, 12:03 p.m.
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
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.

Comments

Nick Clifton May 15, 2018, 12:09 p.m. | #1
Hi Christophe,

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


Approved (mainline and 2.30 branch).

Cheers
  Nick

Patch

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: