diff --git a/elfio/elfio.hpp b/elfio/elfio.hpp index 3a86c9393fbefb5e8efeeebea3d18b195d38b503..69160ff157409c22212ee31f8758840c0b4b1708 100644 --- a/elfio/elfio.hpp +++ b/elfio/elfio.hpp @@ -632,7 +632,8 @@ class elfio // Fix up the alignment if ( !section_generated[index] && sec->is_address_initialized() && SHT_NOBITS != sec->get_type() - && SHT_NULL != sec->get_type() ) { + && SHT_NULL != sec->get_type() + && 0 != sec->get_size() ) { // Align the sections based on the virtual addresses // when possible (this is what matters for execution) Elf64_Off req_offset = sec->get_address() - seg->get_virtual_address();