Without more context I can't see what is wrong with the original code.

The second argument is passed by value and the local value is overwritten only 
in the function when the old pointer is never used again. This is valid in C 
and this code is tested by our testsuite as far as I can tell.


Do you have some example code that shows how it fails for you?

In most similar cases where I reviewed similar problems the cause was really a 
pool handling bug, either in Subversion (where old code often passes the same 
pool as scratch and result pool, so the wrong pool could be used somewhere) or 
in the user code.


Bert






Sent from Windows Mail





From: Maximo, Andre (GE Global Research)
Sent: ‎Thursday‎, ‎October‎ ‎24‎, ‎2013 ‎1‎:‎51‎ ‎PM
To: users@subversion.apache.org






Hi,

  the function “svn_client_url_from_path2” in “libsvn_client/url.c” re-uses the 
const char* argument “path_or_url” as both output and input of the 
svn_dirent_get_absolute call and this causes the function to crash. The 
crashing line is:

 

  SVN_ERR(svn_dirent_get_absolute(&path_or_url, path_or_url, scratch_pool));

 

  The description of my developing environment is:

 

  O.S.: Windows 7

  Release: Subversion 1.8.3

  Compiler: MS Visual Studio 2010

  No modifications to SVN

  DB: FSFS

 Additional details: I replicate the problem using the same const char * 
variable in both arguments of the svn_dirent_get_absolute call (crashing in the 
same way) and made it to pass ok on this call by having another const char * as 
output. Replicated code snipet crashing:

 

  err = svn_dirent_get_absolute(&path, path, local_pool);

 

  And the ok code snipet:

 

  const char *local_path=NULL;

  err = svn_dirent_get_absolute(&local_path, path, local_pool);

 

  Should the function “svn_client_url_from_path2” have a “local_path_or_url” 
variable for output as all the other client functions that use 
“svn_dirent_get_absolute” have?

 

Thanks for your attention,

 

Andre Maximo, PhD

Information Visualization Researcher – Systems Integration

GE Global Research

T +55 21 3733 8190
M +55 21 6921 3377
max...@ge.com

Rua Paulo Emidio Barbosa, 485 - Qd 1 A

Ilha do Fundao - Parque Tecnologico
Rio de Janeiro, 2194-615 Brazil


GE imagination at work

Reply via email to