[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Segfault in python-binding

From: Enrico Scholz <enrico.scholz_at_informatik.tu-chemnitz.de>
Date: 2004-11-13 01:33:36 CET

enrico.scholz@informatik.tu-chemnitz.de (Enrico Scholz) writes:

> the program at http://www-user.tu-chemnitz.de/~ensc/pysvn.py segfaults
> in some environments, or gives wrong results in other ones:
>
> | [ensc@kosh python]$ python xxx.py
> | 1
> | 1
> | 2 2004-11-11T01:09:35.099407Z
> | Segmentation fault

I digged a little bit more into it... The relevant, swig-generated code
is

| 2550 static PyObject *_wrap_svn_client_commit(PyObject *self, PyObject *args) {
| 2551 PyObject *resultobj;
| 2552 svn_client_commit_info_t **arg1 = (svn_client_commit_info_t **) 0 ;
| ...
| 2559 svn_client_commit_info_t *temp1 ;
| ...
| 2571 arg1 = (svn_client_commit_info_t **)&temp1;
| ...
| 2585 result = (svn_error_t *)svn_client_commit(arg1,(apr_array_header_t const *)arg2,arg3,arg4,arg5);

This means, that 'temp1' (the commit_info_t result) is uninitialized when
given to svn_client_commit() and may be !=0 (depending on stackcontent).

In the noop case (nothing to commit; which is triggered by the example),
the svn_client_commit() function does not modify *arg1 (resp. temp1) and
the following code uses the bad content. 'result' is 0 in this case and
signals success.

'svn_client_commit()' should initialize '*commit_info' everytime when
the function succeeds (as in this case). Perhaps I missed to set some
members of 'ctx' but the segfault should not happen in python...

Enrico

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Nov 13 01:33:55 2004

This is an archived mail posted to the Subversion Dev mailing list.