Skip to content

Commit fb8fdbb

Browse files
committed
variant: Support cast to uint64
1 parent 0f50b58 commit fb8fdbb

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

frida/_frida/extension.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,6 +2002,31 @@ PyGObject_unmarshal_variant_from_sequence (PyObject * sequence, GVariant ** vari
20022002

20032003
is_tuple = PyTuple_Check (sequence);
20042004

2005+
if (is_tuple && PyTuple_Size (sequence) == 2)
2006+
{
2007+
gchar * type;
2008+
gboolean is_uint64_cast;
2009+
2010+
if (!PyGObject_unmarshal_string (PyTuple_GetItem (sequence, 0), &type))
2011+
return FALSE;
2012+
2013+
is_uint64_cast = strcmp (type, "uint64") == 0;
2014+
2015+
g_free (type);
2016+
2017+
if (is_uint64_cast)
2018+
{
2019+
unsigned PY_LONG_LONG l;
2020+
2021+
l = PyLong_AsUnsignedLongLong (PyTuple_GetItem (sequence, 1));
2022+
if (l == (unsigned PY_LONG_LONG) -1 && PyErr_Occurred ())
2023+
return FALSE;
2024+
2025+
*variant = g_variant_ref_sink (g_variant_new_uint64 (l));
2026+
return TRUE;
2027+
}
2028+
}
2029+
20052030
g_variant_builder_init (&builder, is_tuple ? G_VARIANT_TYPE_TUPLE : G_VARIANT_TYPE ("av"));
20062031

20072032
n = PySequence_Length (sequence);

0 commit comments

Comments
 (0)