ModelCacheMixin does not handle extra_constraints correctly for min
- Ngôn ngữ chính
- Python
- Star
- 334
- Fork
- 105
- Merge trung bình
- 6 giờ 1 phút
- Pull request đã merge (30 ngày)
- 3
Mô tả
### Description
Calling `min` with non-empty extra constraints results in an incorrect value, because the expression is found in `_min_exhausted` and cached results are incorrectly used to calculate the minimum.
A simple reproducer:
```
import claripy
s = claripy.Solver()
x = claripy.BVS("x", 64)
y = claripy.BVS("y", 64)
s.add(x - y >= 4)
s.add(y > 0)
print(s.min(x))
print(s.min(x, extra_constraints=[x > 1]))
```
The last line prints 3 even though the correct answer is 2.
A simple solution would skip checking `_min_exhausted` and using cached results when extra constraints are passed. A related bug seems to has been fixed previously in https://github.com/angr/claripy/commit/9d4b861ecfd4763be75c2ef7563a895aafe9db4f.
The issue also seems to apply to `max` and possibly `eval`.
### Steps to reproduce the bug
_No response_
### Environment
_No response_
### Additional context
_No response_
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.