History

Don't use stale section data pointers

put_elf_reloca might reallocate the section into which we point, so don't remember the pointer just the offset.

Michael Matz committed 5 years ago

Commit 30814df1 parent 468e5921 file · +4 −4Browse files

Unified · Split

tccgen.c+4−4
@@ -8034,10 +8034,10 @@ static void init_putv(init_params *p, CType *type, unsigned long c) · 8033 unmodified lines
8034 includes relocations. Use the fact that relocs are8034 includes relocations. Use the fact that relocs are
8035 created it order, so look from the end of relocs8035 created it order, so look from the end of relocs
8036 until we hit one before the copied region. */8036 until we hit one before the copied region. */
8037 int num_relocs = ssec->reloc->data_offset / sizeof(*rel);8037 unsigned long relofs = ssec->reloc->data_offset;
8038 rel = (ElfW_Rel*)(ssec->reloc->data + ssec->reloc->data_offset);8038 while (relofs >= sizeof(*rel)) {
8039 while (num_relocs--) {8039 relofs -= sizeof(*rel);
8040 rel--;8040 rel = (ElfW_Rel*)(ssec->reloc->data + relofs);
8041 if (rel->r_offset >= esym->st_value + size)8041 if (rel->r_offset >= esym->st_value + size)
8042 continue;8042 continue;
8043 if (rel->r_offset < esym->st_value)8043 if (rel->r_offset < esym->st_value)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t