[issue2443] uninitialized access to va_list

2009-05-31 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Reducing the priority and updating the target releases, since from the
discussion there doesn't appear to be a bug here.

--
nosy: +r.david.murray
priority: critical - normal
stage:  - commit review
versions: +Python 2.7, Python 3.2 -Python 2.5, Python 2.6, Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2443
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2443] uninitialized access to va_list

2009-03-30 Thread Daniel Stutzbach

Daniel Stutzbach dan...@stutzbachenterprises.com added the comment:

Rolland,

The va_list is initialized by the function that calls objargs_mktuple. 
va_start() and va_end() need to be called in the function that takes
... as a parameter, and it is.

Not a bug, but +1 on Alexander's patch to consolidate all the #ifdef's
for cleanliness.

--
nosy: +stutzbach

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2443
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2443] uninitialized access to va_list

2008-08-21 Thread Benjamin Peterson

Changes by Benjamin Peterson [EMAIL PROTECTED]:


--
priority: critical - release blocker

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2443
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2443] uninitialized access to va_list

2008-07-30 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

What's the status of this?

--
nosy: +benjamin.peterson

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2443
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2443] uninitialized access to va_list

2008-03-27 Thread Rolland Dudemaine

Rolland Dudemaine [EMAIL PROTECTED] added the comment:

Actually, this thing is more complex to solve than I thought.
Specifically, as described in
http://www.opengroup.org/onlinepubs/007908775/xsh/stdarg.h.html stdarg
requires that variable argument functions have at least one fixed argument.
This is implied by the declaration of void va_start(va_list ap, argN);.
As explained in the original ticket description, and also described
before in the above link, va_start() must be called before any call to
va_arg(), and this includes any access to the argument list using
__va_copy namely.

The problem is that at least objargs_mktuple(), line 2649 of
Objects/abstract.c does not have a first fixed argument.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2443
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2443] uninitialized access to va_list

2008-03-25 Thread Alexander Belopolsky

Alexander Belopolsky [EMAIL PROTECTED] added the comment:

This is not a bug.  All the reported functions expect va_list argument 
to be initialized before being called.  AFAICT, they are consistently 
used in this way.  For example,

PyObject *
PyObject_CallFunctionObjArgs(PyObject *callable, ...)
{
PyObject *args, *tmp;
va_list vargs;

if (callable == NULL)
return null_error();

/* count the args */
va_start(vargs, callable);
args = objargs_mktuple(vargs);
va_end(vargs);
if (args == NULL)
return NULL;
tmp = PyObject_Call(callable, args, NULL);
Py_DECREF(args);

return tmp;
}

This may need to be clarified in the docs.  For example, PyString_FromFormatV 
does not mention that vargs needs to be 
initialized: http://docs.python.org/dev/c-
api/string.html#PyString_FromFormatV.  On the other hand, this may be 
obvious to most C programmers.

I suggest to close this issue as invalid.

--
nosy: +belopolsky

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2443
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2443] uninitialized access to va_list

2008-03-25 Thread Alexander Belopolsky

Alexander Belopolsky [EMAIL PROTECTED] added the comment:

On the second thought the macro dance highlighted by OP belongs to 
pyport.h.  Attached patch defines Py_VA_COPY macro and uses it to simplify   
va_list copying code.

--
keywords: +patch
Added file: http://bugs.python.org/file9849/issue2443.diff

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2443
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2443] uninitialized access to va_list

2008-03-25 Thread Christian Heimes

Christian Heimes [EMAIL PROTECTED] added the comment:

Looks like a good idea to me

--
priority: high - critical
resolution:  - accepted

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2443
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2443] uninitialized access to va_list

2008-03-25 Thread Rolland Dudemaine

Rolland Dudemaine [EMAIL PROTECTED] added the comment:

This is what I meant. The initialization should be done by calling 
va_start(count_va); as you described.
In the files and lines I reported though, this is not called.
I'll file a patch for it soon.
--Rolland Dudemaine

Alexander Belopolsky wrote:
 Alexander Belopolsky [EMAIL PROTECTED] added the comment:

 This is not a bug.  All the reported functions expect va_list argument
 to be initialized before being called.  AFAICT, they are consistently
 used in this way.  For example,

 PyObject *
 PyObject_CallFunctionObjArgs(PyObject *callable, ...)
 {
 PyObject *args, *tmp;
 va_list vargs;

 if (callable == NULL)
 return null_error();

 /* count the args */
 va_start(vargs, callable);
 args = objargs_mktuple(vargs);
 va_end(vargs);
 if (args == NULL)
 return NULL;
 tmp = PyObject_Call(callable, args, NULL);
 Py_DECREF(args);

 return tmp;
 }

 This may need to be clarified in the docs.  For example, PyString_FromFormatV 
 does not mention that vargs needs to be
 initialized: http://docs.python.org/dev/c-
 api/string.html#PyString_FromFormatV.  On the other hand, this may be
 obvious to most C programmers.

 I suggest to close this issue as invalid.

 --
 nosy: +belopolsky

 __
 Tracker [EMAIL PROTECTED]
 http://bugs.python.org/issue2443
 __


--
title: Define Py_VA_COPY macro as a cross-platform replacement for gcc 
__va_copy - uninitialized access to va_list

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2443
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2443] uninitialized access to va_list

2008-03-21 Thread Rolland Dudemaine

New submission from Rolland Dudemaine [EMAIL PROTECTED]:

In many files, the following code is present (with slight variations,
but the important part is there) :
static PyObject *
objargs_mktuple(va_list va)
{
int i, n = 0;
va_list countva;
PyObject *result, *tmp;

#ifdef VA_LIST_IS_ARRAY
memcpy(countva, va, sizeof(va_list));
#else
#ifdef __va_copy
__va_copy(countva, va);
#else
countva = va;
#endif
#endif

...

memcpy() is accessing va_list before it is initialized.

Before the first access to a va_list type variable, and after the last
access to that variable, calls to va_start() and va_end() must be made
to initialize and free the variable.

Such behaviour should be corrected in the following files :
- Objects/abstract.c, line 1901
- Objects/stringobject.c, line 162
- getargs.c, line 66
- getargs.c, line 1188
- modsupport.c, line 479

--
components: Build
messages: 64234
nosy: rolland
severity: normal
status: open
title: uninitialized access to va_list
type: compile error
versions: Python 2.5, Python 2.6, Python 3.0

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2443
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2443] uninitialized access to va_list

2008-03-21 Thread Christian Heimes

Christian Heimes [EMAIL PROTECTED] added the comment:

Can you provide a patch for 2.6 against the latest svn checkout of the
trunk please?

--
components: +Interpreter Core -Build
nosy: +tiran
priority:  - high

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2443
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com