From ba3037912d846ad17eeb18d01c1538fe1f6a137c Mon Sep 17 00:00:00 2001 From: denfromufa Date: Wed, 10 Feb 2016 18:21:44 -0600 Subject: [PATCH 1/3] Update converter.cs --- src/runtime/converter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/converter.cs b/src/runtime/converter.cs index 4d0c06c11..92b9cfe56 100644 --- a/src/runtime/converter.cs +++ b/src/runtime/converter.cs @@ -578,10 +578,10 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result, goto type_error; } ival = Runtime.PyInt_AsLong(op); + Runtime.Decref(op); if (ival > Char.MaxValue || ival < Char.MinValue) { goto overflow; } - Runtime.Decref(op); result = (char)ival; return true; From 634021e465ba05d045a4d67fe98bf61c62ef7363 Mon Sep 17 00:00:00 2001 From: denfromufa Date: Thu, 11 Feb 2016 16:04:13 -0600 Subject: [PATCH 2/3] Update converter.cs --- src/runtime/converter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/converter.cs b/src/runtime/converter.cs index 92b9cfe56..b156b5637 100644 --- a/src/runtime/converter.cs +++ b/src/runtime/converter.cs @@ -684,7 +684,8 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result, } goto type_error; } - double dd = Runtime.PyFloat_AsDouble(value); + double dd = Runtime.PyFloat_AsDouble(op); + Runtime.Decref(op); if (dd > Single.MaxValue || dd < Single.MinValue) { goto overflow; } From 9c737ea94f2ee22c147ee906ba19bb6866fcbba7 Mon Sep 17 00:00:00 2001 From: denfromufa Date: Thu, 11 Feb 2016 16:10:17 -0600 Subject: [PATCH 3/3] Update converter.cs --- src/runtime/converter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/converter.cs b/src/runtime/converter.cs index b156b5637..f03ee7edd 100644 --- a/src/runtime/converter.cs +++ b/src/runtime/converter.cs @@ -644,14 +644,16 @@ static bool ToPrimitive(IntPtr value, Type obType, out Object result, goto type_error; } uint ui = (uint)Runtime.PyLong_AsUnsignedLong(op); - Runtime.Decref(op); + if (Exceptions.ErrorOccurred()) { + Runtime.Decref(op); goto overflow; } IntPtr check = Runtime.PyLong_FromUnsignedLong(ui); int err = Runtime.PyObject_Compare(check, op); Runtime.Decref(check); + Runtime.Decref(op); if (0 != err || Exceptions.ErrorOccurred()) { goto overflow; }