Blame SOURCES/0001-Avoid-a-silent-long-to-int-truncation.patch

a8fba1
From 060dbac3d191cacc558d7ee5fcd6f3e38de48dd6 Mon Sep 17 00:00:00 2001
a8fba1
From: Rui Matos <tiagomatos@gmail.com>
a8fba1
Date: Thu, 21 May 2015 17:53:17 +0200
a8fba1
Subject: [PATCH] Avoid a silent long to int truncation
a8fba1
a8fba1
If the python object contains a value bigger than MAXUINT we'd
a8fba1
silently truncate it when assigning to 'val' and the if condition
a8fba1
would always be true.
a8fba1
a8fba1
This was caught but a coverity scan.
a8fba1
a8fba1
https://bugzilla.gnome.org/show_bug.cgi?id=749698
a8fba1
---
a8fba1
 gi/pygi-value.c | 4 ++--
a8fba1
 1 file changed, 2 insertions(+), 2 deletions(-)
a8fba1
a8fba1
diff --git a/gi/pygi-value.c b/gi/pygi-value.c
a8fba1
index 9d5d0ca..7fdf767 100644
a8fba1
--- a/gi/pygi-value.c
a8fba1
+++ b/gi/pygi-value.c
a8fba1
@@ -382,7 +382,7 @@ pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj)
a8fba1
     case G_TYPE_UINT:
a8fba1
     {
a8fba1
         if (PYGLIB_PyLong_Check(obj)) {
a8fba1
-            guint val;
a8fba1
+            gulong val;
a8fba1
 
a8fba1
             /* check that number is not negative */
a8fba1
             if (PyLong_AsLongLong(obj) < 0)
a8fba1
@@ -390,7 +390,7 @@ pyg_value_from_pyobject_with_error(GValue *value, PyObject *obj)
a8fba1
 
a8fba1
             val = PyLong_AsUnsignedLong(obj);
a8fba1
             if (val <= G_MAXUINT)
a8fba1
-                g_value_set_uint(value, val);
a8fba1
+                g_value_set_uint(value, (guint) val);
a8fba1
             else
a8fba1
                 return -1;
a8fba1
         } else {
a8fba1
-- 
a8fba1
2.4.0
a8fba1