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

Fix incorrect merge in composite solver when child solvers are empty #340

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

ekedaigle
Copy link
Contributor

Simple example to reproduce:

s1 = claripy.SolverComposite()
s2 = claripy.SolverComposite()
m = claripy.BVS("m", 8)
w = claripy.BVS("w", 8)
s1.add(w == 0)
_, sm = s1.merge([s2], [m == 0, m == 1])
sm.eval(w, 2) # returns (0,), despite w being unconstrained in s2

This can also be reproduced though some fairly trivial merges in angr:

s1 = angr.SimState(arch='ARM', mode='symbolic')
x = s1.solver.BVS('x', 32)
s1.regs.r0 = x
s1.add_constraints(s1.regs.r0 == 42)

s2 = s1.copy()
y = s2.solver.BVS('y', 32)
s2.regs.r0 = y
s2.add_constraints(s2.regs.r0 == 43)

m, _, merged = s1.merge(s2)
print(m.solver.eval_upto(m.regs.r0, 10)) # prints [42], but it should be [42, 43]

I will admit I have not been working with claripy all that long, so let me know if there's something fundamental about this I'm misunderstanding. Thanks!

@rhelmot
Copy link
Member

rhelmot commented Feb 23, 2023

This looks fine to me, but I'm not familiar enough with this part of the code to sign off on it. Please someone review this, or else I will merge it and this will be my fault. Don't make it my fault!

@ltfish ltfish self-assigned this Feb 23, 2023
@ltfish ltfish added the bug label Feb 23, 2023
@ltfish ltfish changed the title Fix incorrect merge in composite solver when child solvers are emtpy Fix incorrect merge in composite solver when child solvers are empty Feb 23, 2023
@twizmwazin twizmwazin merged commit 9366ca4 into angr:master Aug 7, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants