[PATCH] tevent: Do not use uninitialized tv in py_tevent_context_add_timer

Lukas Slebodnik lslebodn at fedoraproject.org
Fri Jan 18 15:52:29 UTC 2019


ehlo,

I could see valgrind error in python bindings

LS
-------------- next part --------------
From aad7aee80897f425c39c26a73f5bc457768ff6ee Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at fedoraproject.org>
Date: Fri, 18 Jan 2019 16:37:10 +0100
Subject: [PATCH] tevent: Do not use uninitialized tv in
 py_tevent_context_add_timer

==30== Conditional jump or move depends on uninitialised value(s)
==30==    at 0x5A8D933: tevent_common_insert_timer (tevent_timed.c:178)
==30==    by 0x5A8DA34: tevent_common_add_timer_internal (tevent_timed.c:254)
==30==    by 0x5A8DB76: tevent_common_add_timer_v2 (tevent_timed.c:296)
==30==    by 0x5A7C1AF: py_tevent_context_add_timer_internal.isra.4 (pytevent.c:455)
==30==    by 0x5A7C354: py_tevent_context_add_timer (pytevent.c:484)
==30==    by 0x49BACDD: PyEval_EvalFrameEx (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x49BB491: PyEval_EvalCodeEx (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x49B8D7F: PyEval_EvalFrameEx (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x49BB491: PyEval_EvalCodeEx (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x48F6896: ??? (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x48DD866: PyObject_Call (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x49B2E5C: PyEval_EvalFrameEx (in /usr/lib64/libpython2.7.so.1.0)
==30==
==30== Conditional jump or move depends on uninitialised value(s)
==30==    at 0x5A8DEB8: tevent_common_loop_timer_delay (tevent_timed.c:428)
==30==    by 0x5A8F14A: epoll_event_loop_once (tevent_epoll.c:922)
==30==    by 0x5A8D33A: std_event_loop_once (tevent_standard.c:110)
==30==    by 0x5A88534: _tevent_loop_once (tevent.c:772)
==30==    by 0x5A7C4B7: py_tevent_context_loop_once (pytevent.c:292)
==30==    by 0x49BA936: PyEval_EvalFrameEx (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x49BB491: PyEval_EvalCodeEx (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x49B8D7F: PyEval_EvalFrameEx (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x49BB491: PyEval_EvalCodeEx (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x48F6896: ??? (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x48DD866: PyObject_Call (in /usr/lib64/libpython2.7.so.1.0)
==30==    by 0x49B2E5C: PyEval_EvalFrameEx (in /usr/lib64/libpython2.7.so.1.0)

Signed-off-by: Lukas Slebodnik <lslebodn at fedoraproject.org>
---
 lib/tevent/pytevent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c
index 369ec6e02c841fe563ee7505d6f0d3a4295149f7..e172a848cd897054de02a3699dfb2c72c46efa63 100644
--- a/lib/tevent/pytevent.c
+++ b/lib/tevent/pytevent.c
@@ -476,7 +476,7 @@ static PyObject *py_tevent_context_add_timer_internal(TeventContext_Object *self
 
 static PyObject *py_tevent_context_add_timer(TeventContext_Object *self, PyObject *args)
 {
-	struct timeval next_event;
+	struct timeval next_event = { 0 };
 	PyObject *callback;
 	if (!PyArg_ParseTuple(args, "lO", &next_event, &callback))
 		return NULL;
-- 
2.20.1



More information about the samba-technical mailing list