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

Remove uninitialized member from Base #547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions claripy/algorithm/simplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ def simplify(expr: T) -> T:
simplification_cache[expr.hash()] = expr
return expr

# Copy some parameters (that should really go to the Annotation backend)
simplified._uninitialized = expr.uninitialized

# dealing with annotations
if expr.annotations:
ast_args = tuple(a for a in expr.args if isinstance(a, Base))
Expand Down
28 changes: 0 additions & 28 deletions claripy/ast/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ class Base:
# Caching
_cached_encoded_name: bytes | None

# Extra information
_uninitialized: bool

__slots__ = [
"op",
"args",
Expand All @@ -129,7 +126,6 @@ class Base:
"_relocatable_annotations",
"_errored",
"_cached_encoded_name",
"_uninitialized",
"__weakref__",
]

Expand All @@ -144,7 +140,6 @@ def __new__( # pylint:disable=redefined-builtin
symbolic: bool | None = None,
variables: frozenset[str] | None = None,
errored: set[Backend] | None = None,
uninitialized: bool = False,
annotations: tuple[Annotation, ...] = (),
skip_child_annotations: bool = False,
length: int | None = None,
Expand Down Expand Up @@ -218,7 +213,6 @@ def __new__( # pylint:disable=redefined-builtin
symbolic=symbolic,
length=length,
errored=errored,
uninitialized=uninitialized,
annotations=annotations,
encoded_name=encoded_name,
depth=depth,
Expand All @@ -241,7 +235,6 @@ def make_like(
annotations: tuple[Annotation, ...] | None = None,
variables: frozenset[str] | None = None,
symbolic: bool | None = None,
uninitialized: bool = False,
skip_child_annotations: bool = False,
length: int | None = None,
) -> Self:
Expand All @@ -254,7 +247,6 @@ def make_like(
and annotations
and variables is None
and symbolic is None
and uninitialized is False
and skip_child_annotations
and length is not None
):
Expand Down Expand Up @@ -282,7 +274,6 @@ def make_like(
symbolic=self.symbolic,
annotations=annotations,
length=length,
uninitialized=self._uninitialized,
)

result._hash = h
Expand All @@ -297,8 +288,6 @@ def make_like(
annotations = self.annotations if not args or not any(self is arg for arg in args) else ()
if variables is None and op in all_operations:
variables = self.variables
if uninitialized is None:
uninitialized = self._uninitialized
if symbolic is None and op in all_operations:
symbolic = self.symbolic

Expand All @@ -307,7 +296,6 @@ def make_like(
args if simplified is None else simplified.args,
annotations=annotations,
variables=variables,
uninitialized=uninitialized,
symbolic=symbolic,
skip_child_annotations=skip_child_annotations,
length=length,
Expand All @@ -322,7 +310,6 @@ def __a_init__(
symbolic: bool | None = None,
length: int | None = None,
errored: set[Backend] | None = None,
uninitialized: bool = False,
annotations: tuple[Annotation, ...] | None = None,
encoded_name: bytes | None = None,
depth: int | None = None,
Expand Down Expand Up @@ -353,8 +340,6 @@ def __a_init__(

self._errored = errored if errored is not None else set()

self._uninitialized = uninitialized

if len(self.args) == 0:
raise ClaripyOperationError("AST with no arguments!")

Expand Down Expand Up @@ -963,16 +948,3 @@ def cardinality(self) -> int:
@property
def concrete(self) -> bool:
return not self.symbolic

@property
def uninitialized(self) -> bool:
"""
Whether this AST comes from an uninitialized dereference or not. It's only used in under-constrained symbolic
execution mode.

:returns: True/False/None (unspecified).
"""

# TODO: It should definitely be moved to the proposed Annotation backend.

return self._uninitialized
4 changes: 2 additions & 2 deletions claripy/ast/bv.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ def SI(
)


def TSI(bits, name=None, uninitialized=False, explicit_name=None):
def TSI(bits, name=None, explicit_name=None):
name = "unnamed" if name is None else name
return BVS(name, bits, uninitialized=uninitialized, explicit_name=explicit_name)
return BVS(name, bits, explicit_name=explicit_name)


def ESI(bits, **kwargs):
Expand Down
5 changes: 1 addition & 4 deletions claripy/ast/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ def indexOf(self, pattern, start_idx):
return StrIndexOf(self, pattern, start_idx)


def StringS(name, uninitialized=False, explicit_name=False, **kwargs):
def StringS(name, explicit_name=False, **kwargs):
"""
Create a new symbolic string (analogous to z3.String())

:param name: The name of the symbolic string (i. e. the name of the variable)
:param uninitialized: Whether this value should be counted as an "uninitialized" value in the course of an
analysis.
:param bool explicit_name: If False, an identifier is appended to the name to ensure uniqueness.

:returns: The String object representing the symbolic string
Expand All @@ -63,7 +61,6 @@ def StringS(name, uninitialized=False, explicit_name=False, **kwargs):
"StringS",
(n,),
symbolic=True,
uninitialized=uninitialized,
variables=frozenset((n,)),
**kwargs,
)
Expand Down
4 changes: 2 additions & 2 deletions claripy/backends/backend_vsa/backend_vsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ def widen(self, ast):
return ret

@staticmethod
def CreateTopStridedInterval(bits, name=None, uninitialized=False):
return StridedInterval.top(bits, name, uninitialized=uninitialized)
def CreateTopStridedInterval(bits, name=None):
return StridedInterval.top(bits, name)

def constraint_to_si(self, expr):
return Balancer(self, expr).compat_ret
Expand Down
Loading
Loading