diff options
author | Freya Murphy <freya@freyacat.org> | 2024-09-22 16:44:54 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-09-22 16:44:54 -0400 |
commit | bf39d3283bbc83773459ae5d399ead2bf4452fb7 (patch) | |
tree | 9826d286dba8ec8f0b6fe23af5aafbc7f4e48ad2 /mld/link.c | |
parent | mld done (diff) | |
download | mips-bf39d3283bbc83773459ae5d399ead2bf4452fb7.tar.gz mips-bf39d3283bbc83773459ae5d399ead2bf4452fb7.tar.bz2 mips-bf39d3283bbc83773459ae5d399ead2bf4452fb7.zip |
fix mem errors
Diffstat (limited to '')
-rw-r--r-- | mld/link.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -399,6 +399,10 @@ static int relocate_instruction_rela(struct linker *linker, /// get the segment that the symbol is in struct segment_table_entry *ent; const char *segname = seg->obj->shstrtab->data + B32(shdr->sh_name); + if (B32(shdr->sh_name) >= seg->obj->shstrtab->len) { + ERROR("relocation segment name out of bounds"); + return M_ERROR; + } if (segtab_get(&linker->segments, &ent, segname)) { ERROR("could not locate segment for relocation"); return M_ERROR; |