To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 6e79d6df authored by Zixian Cai's avatar Zixian Cai
Browse files

Fix bug when modifying ctypes values (they only accept Python values)

parent 0680f316
......@@ -33,14 +33,14 @@ class MuUPtrProxy(object):
byte_offset = ctypes.sizeof(c_type)
return MuUPtrProxy(self.of, address=self.address + offset * byte_offset)
def load(self, value):
def load(self):
c_type = map_primitive(self.of)
return c_type.from_address(self.address)
def store(self, value):
c_value = map_mu_value(value)
c_type = map_primitive(self.of)
c_type.from_address(self.address).value = c_value
c_type.from_address(self.address).value = c_value.value
def cast(self, to):
self.of = to
......@@ -92,7 +92,7 @@ def map_type(ty):
# Primitive
def map_primitive(p_type):
assert isinstance(p_type, mutype.MuPrimitive)
if isinstance(p_type, mutype.MU_VOID):
if p_type._name == "MU_VOID":
return map_void(p_type)
elif isinstance(p_type, mutype.MuNumber):
return map_number(p_type)
......@@ -228,4 +228,10 @@ def map_mu_value(muv):
if hasattr(muv, "_from_c"):
return muv.get_c_value
else:
raise NotImplementedError
return map_mu_int(muv) # Placeholder
def map_mu_int(muv):
mu_type = mutype.mutypeOf(muv)
c_type = map_type(mu_type)
return c_type(muv)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment