Skip to content
Snippets Groups Projects
Commit d800c7b2 authored by Martin Bickel's avatar Martin Bickel Committed by Serge Lamikhov-Center
Browse files

When saving a previously loaded ELF file, don't shrink segments' memory size

parent 213dbeda
No related branches found
No related tags found
No related merge requests found
......@@ -728,7 +728,15 @@ class elfio
}
seg->set_file_size( segment_filesize );
seg->set_memory_size( segment_memory );
// If we already have a memory size from loading an elf file (value > 0),
// it must not shrink!
// Memory size may be bigger than file size and it is the loader's job to do something
// with the surplus bytes in memory, like initializing them with a defined value.
if ( seg->get_memory_size() < segment_memory ) {
seg->set_memory_size( segment_memory );
}
seg->set_offset(seg_start_pos);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment