PR24909, Uninitialized use on stack in readelf
authorAlan Modra <amodra@gmail.com>
Fri, 16 Aug 2019 05:47:23 +0000 (15:17 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 16 Aug 2019 05:47:23 +0000 (15:17 +0930)
PR 24909
PR 23499
* readelf.c (get_symbol_version_string): Set sym_info earlier.

binutils/ChangeLog
binutils/readelf.c

index b7bdfce91c90ffdb84f02e7b56a28174152feb3d..cf8eea7fca2fdd2a391d1655974c8a082f75240e 100644 (file)
@@ -1,3 +1,9 @@
+2019-08-16  Alan Modra  <amodra@gmail.com>
+
+       PR 24909
+       PR 23499
+       * readelf.c (get_symbol_version_string): Set sym_info earlier.
+
 2019-08-15  Nick Clifton  <nickc@redhat.com>
 
        PR 24767
index b90d3bc885cec18ba2fa6effde4df278d1f0ecf1..cc168163b2166795c58e572ebfbd219562fcc20e 100644 (file)
@@ -11528,6 +11528,7 @@ get_symbol_version_string (Filedata *                   filedata,
   if ((vers_data & VERSYM_HIDDEN) == 0 && vers_data == 0)
     return NULL;
 
+  *sym_info = (vers_data & VERSYM_HIDDEN) != 0 ? symbol_hidden : symbol_public;
   max_vd_ndx = 0;
 
   /* Usually we'd only see verdef for defined symbols, and verneed for
@@ -11593,12 +11594,8 @@ get_symbol_version_string (Filedata *                   filedata,
              ivda.vda_name = BYTE_GET (evda.vda_name);
 
              if (psym->st_name != ivda.vda_name)
-               {
-                 *sym_info = ((vers_data & VERSYM_HIDDEN) != 0
-                              ? symbol_hidden : symbol_public);
-                 return (ivda.vda_name < strtab_size
-                         ? strtab + ivda.vda_name : _("<corrupt>"));
-               }
+               return (ivda.vda_name < strtab_size
+                       ? strtab + ivda.vda_name : _("<corrupt>"));
            }
        }
     }