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

Uncaught errors in BitVecConstant constructor #2651

Open
sam-xif opened this issue Jul 10, 2024 · 0 comments
Open

Uncaught errors in BitVecConstant constructor #2651

sam-xif opened this issue Jul 10, 2024 · 0 comments
Labels

Comments

@sam-xif
Copy link

sam-xif commented Jul 10, 2024

Summary of the problem

Hello manticore community,

I am working as part of a research team developing a code analysis tool for Python. One of the issues the tool discovered in manticore's codebase is that the constructor for BitVecConstant has the potential to throw uncaught OverflowError, MemoryError, and ValueError. The OverflowError and MemoryError are caused by a very large positive value for the size argument, while the ValueError is caused by a negative value for the size argument.

If you are interested in learning more about the tool and how it found this issue, let me know down in the comments, or you can contact me at [email protected]. We are primarily curious about whether you find that this issue is legitimate and worth reporting and fixing. If not, we would be interested in understanding why.

Thank you for your consideration!

-Sam

Manticore version

Latest master (commit hash: 8861005)

Python version

Python 3.8

OS / Environment

Linux (kernel version 5.10.218)

Dependencies

N/A

Step to reproduce the behavior

Call BitVecConstant constructor with very large positive values or negative values for size.

Expected behavior

Assertion failure indicating that size should be nonnegative, and/or checks to ensure that size is not extremely large.

Actual behavior

Errors are thrown uncaught.

Any relevant logs

Stack traces:

Traceback (most recent call last):
  ...
  File ".../repos/manticore/manticore/core/smtlib/expression.py", line 547, in __init__
    MASK = (1 << size) - 1
ValueError: negative shift count
Traceback (most recent call last):
  ...
  File ".../repos/manticore/manticore/core/smtlib/expression.py", line 547, in __init__
    MASK = (1 << size) - 1
OverflowError: too many digits in integer
Traceback (most recent call last):
  ...
  File ".../repos/manticore/manticore/core/smtlib/expression.py", line 547, in __init__
    MASK = (1 << size) - 1
MemoryError
@sam-xif sam-xif added the bug label Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant