From 79fcd11595d0793dec593e9072e36c7923c57c1a Mon Sep 17 00:00:00 2001 From: Serge Lamikhov-Center Date: Sat, 5 Jun 2021 16:46:24 +0300 Subject: [PATCH] Add check for data endianess flags --- elfio/elfio.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/elfio/elfio.hpp b/elfio/elfio.hpp index 7146ec2..22db7a4 100644 --- a/elfio/elfio.hpp +++ b/elfio/elfio.hpp @@ -129,6 +129,11 @@ class elfio return false; } + if ( ( e_ident[EI_DATA] != ELFDATA2LSB ) && + ( e_ident[EI_DATA] != ELFDATA2MSB ) ) { + return false; + } + convertor.setup( e_ident[EI_DATA] ); header = create_header( e_ident[EI_CLASS], e_ident[EI_DATA] ); if ( 0 == header ) {