angr / claripy

An abstraction layer for constraint solvers.
BSD 2-Clause "Simplified" License
273 stars 90 forks source link

Base.replace cannot work on Bool #370

Open francis0407 opened 10 months ago

francis0407 commented 10 months ago

Description

import claripy
b = claripy.BoolS("b")
expr = claripy.If(b, claripy.BVV(2, 32), claripy.BVV(3, 32))
new_expr = expr.replace(b, claripy.BoolV(True))

Error:

    @staticmethod
     41     def _check_replaceability(old, new):
---> 42         if old.size() != new.size():
     43             raise ClaripyOperationError('replacements must have matching sizes')

AttributeError: size

Current workaround:

new_expr = expr.replace_dict({b.cache_key: claripy.BoolV(True)})

Steps to reproduce the bug

No response

Environment

No response

Additional context

No response