Skip to content

Commit 5508eba

Browse files
author
jkoshy
committed
Verify that only one of the LIBELF_F_RAWFILE_{MALLOC,MMAP}
flags is set on an ELF descriptor. git-svn-id: svn://svn.code.sf.net/p/elftoolchain/code/trunk@3740 95820547-d848-0410-985e-9ae8fe0fa350
1 parent b09b478 commit 5508eba

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libelf/elf_update.c

+2
Original file line numberDiff line numberDiff line change
@@ -1126,12 +1126,14 @@ _libelf_write_elf(Elf *e, off_t newsize, struct _Elf_Extent_List *extents)
11261126
assert((e->e_flags & LIBELF_F_RAWFILE_MALLOC) ||
11271127
(e->e_flags & LIBELF_F_RAWFILE_MMAP));
11281128
if (e->e_flags & LIBELF_F_RAWFILE_MALLOC) {
1129+
assert((e->e_flags & LIBELF_F_RAWFILE_MMAP) == 0);
11291130
free(e->e_rawfile);
11301131
e->e_rawfile = newfile;
11311132
newfile = NULL;
11321133
}
11331134
#if ELFTC_HAVE_MMAP
11341135
else if (e->e_flags & LIBELF_F_RAWFILE_MMAP) {
1136+
assert((e->e_flags & LIBELF_F_RAWFILE_MALLOC) == 0);
11351137
if ((e->e_rawfile = mmap(NULL, (size_t) newsize,
11361138
PROT_READ, MAP_PRIVATE, e->e_fd, (off_t) 0)) ==
11371139
MAP_FAILED) {

0 commit comments

Comments
 (0)