Fix NULL deference for no ELF files

Fix crash 060833f08dc14d1712428742b3cad7af17b36bb7
This commit is contained in:
alvaro 2017-07-04 22:48:36 +02:00 committed by Serge Lamikhov-Center
parent bd5f2128ae
commit abab994411

View File

@ -148,12 +148,11 @@ class elfio
{
std::ofstream f( file_name.c_str(), std::ios::out | std::ios::binary );
if ( !f ) {
if ( !f || !header) {
return false;
}
bool is_still_good = true;
// Define layout specific header fields
// The position of the segment table is fixed after the header.
// The position of the section table is variable and needs to be fixed