-
-
Notifications
You must be signed in to change notification settings - Fork 635
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
Parser::parse
crashes for PE files on Windows 7
#998
Comments
Can you attach the binary? |
@romainthomas Minimal reproducible exemple below, already compiled. #include <LIEF/PE.hpp>
using namespace LIEF::PE;
typedef struct {
char *name;
void *address;
} symbol_t;
bool enum_symbols(char *path, bool callback(symbol_t *, void *), void *arg)
{
symbol_t sym;
std::unique_ptr<const Binary> binary;
if (!is_pe(path))
return false;
binary = Parser::parse(path);
for (const ExportEntry &symbol : binary->get_export()->entries()) {
sym.name = (char *)symbol.name().c_str();
sym.address = (void *)symbol.value();
if (!callback(&sym, arg))
break;
}
return true;
}
bool callback(symbol_t *sym, void *arg)
{
printf(" %s %p\n", sym->name, sym->address);
return true;
}
int main(int argc, char **argv)
{
if (argc < 2) {
printf("missing binary path argument\n");
return -1;
}
printf("Symbols: \n");
enum_symbols(argv[1], callback, NULL);
return 0;
} NOTE: The file extension is |
@romainthomas Even in this example, it just crashes upon calling |
It has been fixed [...] |
I just tested and the fix worked, but I had to change my code a bit. |
Description
When calling
Parser::parse
on Windows 7 for a PE file, the program crashes, giving the error:I need this fixed because my memory library relies on LIEF for dumping symbols.
Context
LIEF version: latest commit as of now: df97777
OS: Windows 7 x64
Visual Studio Build Tools 2022 (building for x86)
My contribution to get this premium issue (merged PR that fixes compilation error on Windows): #949
Code that crashes (from my rdbo/libmem repo):
Error:
The text was updated successfully, but these errors were encountered: