[New-bugs-announce] [issue15921] select module uses uninitialized value "tv.tv_usec"

Christian Heimes report at bugs.python.org
Tue Sep 11 14:46:34 CEST 2012


New submission from Christian Heimes:

Starting with Python 3.3 the select module access the uninitialized tv.tv_usec member of a timeval struct. I don't see the point of initializing the local variable long tv_usec from tv.tv_usec. The comment above the code states that long tv_usec is required as a workaround for Mac OS X.

http://hg.python.org/cpython/file/4754c4a710e6/Modules/selectmodule.c#l242

Coverity message:
CID 719694: Uninitialized scalar variable (UNINIT)At (5): Using uninitialized value "tv.tv_usec".
 242        long tv_usec = tv.tv_usec;
 243        if (_PyTime_ObjectToTimeval(tout, &tv.tv_sec, &tv_usec) == -1)
 244            return NULL;
 245        tv.tv_usec = tv_usec;

Suggested fix:
change line 242 to "long tv_usec;"

----------
keywords: 3.3regression
messages: 170299
nosy: christian.heimes
priority: normal
severity: normal
stage: patch review
status: open
title: select module uses uninitialized value "tv.tv_usec"
type: resource usage
versions: Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15921>
_______________________________________


More information about the New-bugs-announce mailing list