Skip to content

Conversation

@hannesweisbach
Copy link

@hannesweisbach hannesweisbach commented Jul 5, 2023

Checking elf header size before elf magic may lead to presenting the user with a misleading error message in case the elf file header is corrupted or a non-elf file was entered into the bif file instead of an elf file (for example bl31.bin instead of bl31.elf.

Instead of receiving the misleading error message:
[ERROR] : ELF Parsing Error !!!
Wrong Header Size

The user is now presented with a more accurate error message:
[ERROR] : ELF Parsing Error !!!
ELF magic identification word wrong

Ramya Darapuneni and others added 3 commits November 3, 2022 15:33
This is to address pull request Xilinx#20
Checking elf header size before elf magic may lead to presenting the user with a misleading error message in case the elf file header is corrupted or a non-elf file was entered into the bif file instead of an elf file (for example bl31.bin instead of bl31.elf.

Instead of receiving the misleading error message:
[ERROR]  : ELF Parsing Error !!!
           Wrong Header Size

The user is now presented with a more accurate error message:
[ERROR]  : ELF Parsing Error !!!
          ELF magic identification word wrong
@kalvdans
Copy link

kalvdans commented Jul 5, 2023

Aren't both messages printed no matter the order of the checks?

@hannesweisbach
Copy link
Author

No, LOG_DEBUG calls Logger::Instance()->Error(), which in turn ends with throw BootGenException which is caught in main() and then the application exists.

@kalvdans
Copy link

kalvdans commented Jul 5, 2023

I see (you mean LOG_ERROR I presume). Then I agree that your suggested order is more natural.

@hannesweisbach
Copy link
Author

Yes, LOG_ERROR, of course 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants