From: Serhiy Storchaka Date: Thu, 7 Feb 2013 15:03:46 +0000 (+0200) Subject: Issue #17073: Fix some integer overflows in sqlite3 module. X-Git-Tag: v3.3.1rc1~212 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2efdc90b0f49866d857a5b3dc21b7c791f7a0aeb;p=python Issue #17073: Fix some integer overflows in sqlite3 module. --- 2efdc90b0f49866d857a5b3dc21b7c791f7a0aeb diff --cc Modules/_sqlite/connection.c index bc4ce50de5,d52bea49c3..28bd647b3f --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@@ -669,9 -675,10 +675,10 @@@ error void _pysqlite_final_callback(sqlite3_context* context) { - PyObject* function_result = NULL; + PyObject* function_result; PyObject** aggregate_instance; - PyObject* aggregate_class; + _Py_IDENTIFIER(finalize); + int ok; #ifdef WITH_THREAD PyGILState_STATE threadstate; @@@ -687,8 -696,15 +694,15 @@@ goto error; } - function_result = PyObject_CallMethod(*aggregate_instance, "finalize", ""); + function_result = _PyObject_CallMethodId(*aggregate_instance, &PyId_finalize, ""); - if (!function_result) { + Py_DECREF(*aggregate_instance); + + ok = 0; + if (function_result) { + ok = _pysqlite_set_result(context, function_result) == 0; + Py_DECREF(function_result); + } + if (!ok) { if (_enable_callback_tracebacks) { PyErr_Print(); } else { diff --cc Modules/_sqlite/statement.c index 9884860ec0,09d95d9a67..471a0676a8 --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@@ -87,10 -88,9 +88,9 @@@ int pysqlite_statement_create(pysqlite_ return rc; } -int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter, int allow_8bit_chars) +int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter) { int rc = SQLITE_OK; - PY_LONG_LONG longlongval; const char* buffer; char* string; Py_ssize_t buflen;