Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

fgets not handling EOF? #62

Open
bannsec opened this issue Jan 14, 2017 · 3 comments
Open

fgets not handling EOF? #62

bannsec opened this issue Jan 14, 2017 · 3 comments

Comments

@bannsec
Copy link
Contributor

bannsec commented Jan 14, 2017

Playing around with an app that uses fgets, when the fgets SimProcedure notices that it runs out of room, it appears to prefer to force a newline character. While that's a valid character, it likely shouldn't force the newline at that point since the implicit EOF after that newline would be the end of fgets processing.

This seems to open the fgets simprocedure up to a very slight misinterpretation of valid fgets input.

@salls
Copy link
Member

salls commented Jan 15, 2017

Does it actually force it?
Looking at the code my guess is that it will be more likely to choose to add a newline because of how the constraints are structures and how z3 solves it. The code looks like it should be able to not include a newline if it hits EOF, let me know if this is not the case

@bannsec
Copy link
Contributor Author

bannsec commented Jan 29, 2017

So, I've noticed that my test case is behaving differently on two systems. One of them, my main box, is simple Ubuntu and uses the git script from angr-dev to set up the environment. In that one, things work as you would expect.

My other environment (well, one of many), is a CentOS box that runs angr based off of pip. Not sure what the reason is, but on this box angr seems to behave a bit differently, and have noticed the newline problems on this one.

At this point i'm unsure what i should do. I can't reliably reproduce it using the Ubutnu git based install, so maybe it's just something funny with pip? Thinking about just closing this issue until I can reliably reproduce it off of the git repo.

@rhelmot
Copy link
Member

rhelmot commented Jan 29, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants