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

getenv Routine causes unhandled exception #17

Open
jordan9001 opened this issue Oct 31, 2023 · 1 comment
Open

getenv Routine causes unhandled exception #17

jordan9001 opened this issue Oct 31, 2023 · 1 comment

Comments

@jordan9001
Copy link

The routine rtn_getenv can return a value of type str.

(Pdb) p type(host_env_val)
<class 'str'>

But __handle_external_return expects the return value to be either an integer or an Expression. When calling write_symbolic_register an exception will be thrown when trying to pass the string to newSymbolicExpression

Logic should be added to have rtn_getenv to return a pointer to the string. The environment may need to be populated on the stack during process creation, as it is with a real process.

@RobinDavid
Copy link
Collaborator

Hello @jordan9001.
The current implementation of getenv is indeed faulty as it return a string while it should not.
Indeed populating the stack at the begining of the execution would be to most accurate modeling. Another option is to allocate a buffer for the string and returning the pointer to it.

A nice implementation would also take to opportunity to symbolize the returned string if it is part of the input (and returning the concrete one otherwise).

Implementing these routines is an endless work and I am lacking time. Feel free to submit a PR, we would be bery happy to review it and to merge it.

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