cozy.primitives
¶
Module Contents¶
Functions¶
|
Generates a fresh symbolic pointer for the input architecture. |
|
Generates claripy expressions for constraining the input symbolic pointer to a specific concrete value. |
|
Converts an integer from two's complement form back to an integer, assuming the value is stored in num_bits space. |
|
Converts an integer value to two's complement representation, assuming the value is stored in num_bits space. |
Attributes¶
- cozy.primitives._malloc_name_ctr = 0¶
- cozy.primitives.sym_ptr(arch: Type[archinfo.Arch], name: str | None = None) claripy.BVS ¶
Generates a fresh symbolic pointer for the input architecture.
- Parameters:
arch (Type[Arch]) – The architecture the pointer is for. For example in x64, the paramater passed should be archinfo.ArchAMD64, and a 64 bit symbolic pointer will be returned.
name (str | None) – A human readable name for the symbolic pointer. If None is passed an autogenerated symbolic_ptr_i name is used.
- Returns:
A fresh symbolic bitvector whose size is appropriate for the input architecture.
- Return type:
claripy.BVS
- cozy.primitives.sym_ptr_constraints(symbolic_ptr: claripy.ast.bits, concrete_addr: int, can_be_null: bool = True) claripy.ast.bool ¶
Generates claripy expressions for constraining the input symbolic pointer to a specific concrete value.
- Parameters:
symbolic_ptr (claripy.ast.bits) – The symbolic pointer to constrain.
concrete_addr (int) – The concrete address which the symbolic pointer should be equal to.
can_be_null (bool) – If this value is True, the returned constraints will contain a disjunction which allows the symbolic pointer to be NULL.
- Returns:
A claripy proposition constraining the symbolic pointer.
- Return type:
claripy.ast.bool
- cozy.primitives.from_twos_comp(val: int, num_bits: int) int ¶
Converts an integer from two’s complement form back to an integer, assuming the value is stored in num_bits space.
- Parameters:
val (int) – The two’s complement integer to convert. This number must be non-negative.
num_bits (int) – The number of bits used to store the number.
- Returns:
A signed Python representation of the integer.
- Return type:
int
- cozy.primitives.to_twos_comp(val: int, num_bits: int) int ¶
Converts an integer value to two’s complement representation, assuming the value is stored in num_bits space.
- Parameters:
val (int) – The integer value to convert.
num_bits (int) – The number of bits used to store the integer.
- Returns:
A two’s complement representation of the value. This value is non-negative.
- Return type:
int