Help solving an exercise
See original GitHub issueHi all, suppose I have this C code:
#include<stdlib.h>
int main(int argc, char *argv[]) {
int a = atoi(argv[1]);
a = a - 10;
int b = a + 1;
if ( b > 3 )
malloc(b);
}
Once compiled the call to malloc is at 0x00000000004005a6
With angr I would like to obtain the min value for argv1 if I have the malloc to be called. The solution should be 13 but I cannot have that result. My code is the following:
import angr
def main():
proj = angr.Project('./example', load_options={"auto_load_libs": False})
argv1 = angr.claripy.BVS("argv1", 64)
initial_state = proj.factory.entry_state(args=["./example", argv1])
initial_path = proj.factory.path(initial_state)
path_group = proj.factory.path_group(initial_state)
path_group.explore(find=0x00000000004005a6)
found = path_group.found[0]
print found.state.se.min(argv1)
if __name__ == '__main__':
main()
My output is:
3112040326038040883
Can you explain me why please?
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
14 Great Exercises to Solve Problems as a Team - Merlin Project
We have put together 14 problem solving exercises for teams to help solve complex problems better. The exercises also promote cooperation, ...
Read more >Top 15 Problem-Solving Activities for Your Team to Master
A problem-solving exercise or game helps identify those strengths and builds problem-solving skills and strategies while having fun with ...
Read more >Try this creative problem solving exercise! - YouTube
... exercise to try next time you're feeling stuck! http://femaleentrepreneurassociation.com/2013/05/a-creative-way-to- solve -your-problems/
Read more >Problem or Exercise? – Mathematics for Elementary Teachers
The main activity of mathematics is solving problems. However, what most people experience in most mathematics classrooms is practice exercises.
Read more >20 Problem Solving Activities to Improve Creativity
These exercises are techniques on how to improve problem solving skills and the art of problem solving. Listed below are 20 interactive exercises...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@frapik99 check
get_signed_range
function here: https://github.com/axt/angr-utils/blob/master/angrutils/expr.pyYou can add a new constraint that limits the most significant bit of your symbolic variable
argv1
to 0 (positive numbers) or 1 (negative numbers), and then callse.min()
orse.max()
respectively.