[pygobject/pygobject-3-26] fix potential overflow when marshalling flags from py interface
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-3-26] fix potential overflow when marshalling flags from py interface
- Date: Thu, 26 Oct 2017 18:10:49 +0000 (UTC)
commit 44a852191a67bc7ef76202412a0102de46eb26f0
Author: Philippe Renon <philippe_renon yahoo fr>
Date: Thu Aug 31 16:39:08 2017 +0200
fix potential overflow when marshalling flags from py interface
the overflow happens on windows platforms when an unsigned
flags value overflows the capacity of a signed long
on windows long is a 32-bit signed integer.
fixes https://bugzilla.gnome.org/show_bug.cgi?id=786948
gi/pygi-enum-marshal.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gi/pygi-enum-marshal.c b/gi/pygi-enum-marshal.c
index 11c2049..44eb009 100644
--- a/gi/pygi-enum-marshal.c
+++ b/gi/pygi-enum-marshal.c
@@ -182,7 +182,7 @@ _pygi_marshal_from_py_interface_flags (PyGIInvokeState *state,
gpointer *cleanup_data)
{
PyObject *py_long;
- long c_long;
+ unsigned long c_ulong;
gint is_instance;
PyGIInterfaceCache *iface_cache = (PyGIInterfaceCache *)arg_cache;
GIBaseInfo *interface;
@@ -195,17 +195,17 @@ _pygi_marshal_from_py_interface_flags (PyGIInvokeState *state,
goto err;
}
- c_long = PYGLIB_PyLong_AsLong (py_long);
+ c_ulong = PYGLIB_PyLong_AsUnsignedLong (py_long);
Py_DECREF (py_long);
/* only 0 or argument of type Flag is allowed */
- if (!is_instance && c_long != 0)
+ if (!is_instance && c_ulong != 0)
goto err;
/* Write c_long into arg */
interface = g_type_info_get_interface (arg_cache->type_info);
g_assert (g_base_info_get_type (interface) == GI_INFO_TYPE_FLAGS);
- if (!gi_argument_from_c_long(arg, c_long,
+ if (!gi_argument_from_c_long(arg, c_ulong,
g_enum_info_get_storage_type ((GIEnumInfo *)interface))) {
g_base_info_unref (interface);
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]