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

Re: segfault on commit

From: Daniel Stenberg <daniel_at_haxx.se>
Date: 2001-03-29 16:57:29 CEST

On Thu, 29 Mar 2001, Kevin Pilch-Bisson wrote:

> Program received signal SIGSEGV, Segmentation fault.
> 0x4025d796 in decrement_dir_ref_count (db=0x0)
> at ../../../subversion/subversion/libsvn_fs/editor.c:89
> 89 db->ref_count--;

decrement_dir_ref_count() never checks the input for NULL and it will call
itself until it crashes.

Something like this might do:

RCS file: /cvs/subversion/subversion/libsvn_fs/editor.c,v
retrieving revision 1.32
diff -u -r1.32 editor.c
--- editor.c 2001/03/28 21:50:30 1.32
+++ editor.c 2001/03/29 14:56:58
@@ -86,6 +86,11 @@
 static svn_error_t *
 decrement_dir_ref_count (struct dir_baton *db)
 {
+ if (db == NULL)
+ {
+ return SVN_NO_ERROR;
+ }
+
   db->ref_count--;

   /* Check to see if *any* child batons still depend on this

-- 
      Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
Received on Sat Oct 21 14:36:26 2006

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