Stop parsing ELF if segment header is beyond end of file

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
This commit is contained in:
Alan Jowett 2022-06-09 19:18:17 -06:00 committed by Serge Lamikhov-Center
parent 1cb8be7aee
commit 3e6809cf13

View File

@ -550,6 +550,11 @@ class elfio
seg->load( stream,
static_cast<std::streamoff>( offset ) +
static_cast<std::streampos>( i ) * entry_size );
if ( stream.fail() ) {
return false;
}
seg->set_index( i );
// Add sections to the segments (similar to readelfs algorithm)