1
1
mirror of https://github.com/rui314/mold.git synced 2024-11-12 23:48:51 +03:00

Merge pull request #807 from ishitatsuyuki/symtab-garbage

[ELF] Fix uninitialized ElfSym paddings
This commit is contained in:
Rui Ueyama 2022-10-22 03:58:07 -07:00 committed by GitHub
commit 1e98ec0b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -1542,6 +1542,7 @@ template <typename E>
void SharedFile<E>::populate_symtab(Context<E> &ctx) {
ElfSym<E> *symtab =
(ElfSym<E> *)(ctx.buf + ctx.symtab->shdr.sh_offset) + this->global_symtab_idx;
memset(symtab, 0, sizeof(ElfSym<E>) * this->num_global_symtab);
u8 *strtab = ctx.buf + ctx.strtab->shdr.sh_offset + this->strtab_offset;

View File

@ -508,7 +508,8 @@ static void load_plugin(Context<E> &ctx) {
template <typename E>
static ElfSym<E> to_elf_sym(PluginSymbol &psym) {
ElfSym<E> esym = {};
ElfSym<E> esym;
memset(&esym, 0, sizeof(esym));
switch (psym.def) {
case LDPK_DEF: