Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code robustness question #7

Open
BlueSkeye opened this issue Mar 23, 2021 · 1 comment
Open

Code robustness question #7

BlueSkeye opened this issue Mar 23, 2021 · 1 comment

Comments

@BlueSkeye
Copy link

BlueSkeye commented Mar 23, 2021

Exercises code contains some error checking and leave aside a couple of cases.
I understand we are in a lab and not seeking for bullet proof and "production ready" code quality.
Could you clarify what level of error checking/robustness you are emphazing, so that we could submit just the right level of issues that could help you reach this level ?

Additionally should you seek to improve error checking, would you prefer textual explanations and suggestions such as #6 or push requests ?

By the way the project is very interesting and I'm looking forward for next episodes;

@hasherezade
Copy link
Owner

I make checks for the cases which are the most casual.

So, it is gonna be a common error to supply a bad path to the PE file - that's why I make checks around opening file and reading from file (the access may be denied for whatever reasons). I don't do checks for the the things which are less casual, or corner cases (such as attempt to load big files which size cannot be retrieved by GetFileSize).

I do check for failure in relocating the PE - because some PEs has no relocation table, and in such case they will not be loadable by this way (as we cannot guarantee at which base we will be able to load them). Relocation will fail also if we try to load a PE of different bitness than a loader. Those are common cases the user of this tool will encounter while playing around with this code.

I want this code to be as simple as possible, so apart from those common things, I don't want to litter it by too many checks. Otherwise it may be difficult for the reader to sieve out what part of code is about processing the PE, and what is about error checking. I also wrote about it in the comment on the top of the file to make the purpose of this code clear.

/*
A demo PE-loader for the training: https://github.com/hasherezade/malware_training_vol1
WARNING: This is a basic example. For the sake of simplicity, some checks have been omitted.
*/

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

No branches or pull requests

2 participants