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

Should svn_fs_fs__noderev_same_rep_key() accept NULL representation_t::uniquifier?

From: Kouhei Sutou <kou_at_cozmixng.org>
Date: Mon, 15 Dec 2008 19:52:25 +0900 (JST)

Hi,

I don't know about svn_fs_fs__noderev_same_rep_key() but it
causes "Segmentation fault" if a->uniquifier or
b->uniquifier is NULL. Should it accepts NULL or not?

If it accepts NULL as valid VALUE:

Index: subversion/libsvn_fs_fs/fs_fs.c
===================================================================
--- subversion/libsvn_fs_fs/fs_fs.c (revision 34710)
+++ subversion/libsvn_fs_fs/fs_fs.c (working copy)
@@ -3435,6 +3435,12 @@
   if (a->revision != b->revision)
     return FALSE;
 
+ if (a->uniquifier == b->uniquifier)
+ return TRUE;
+
+ if (a->uniquifier == NULL || b->uniquifier == NULL)
+ return FALSE;
+
   return strcmp(a->uniquifier, b->uniquifier) == 0;
 }
 

Otherwise:
Index: subversion/libsvn_fs_fs/fs_fs.c
===================================================================
--- subversion/libsvn_fs_fs/fs_fs.c (revision 34710)
+++ subversion/libsvn_fs_fs/fs_fs.c (working copy)
@@ -3435,6 +3435,9 @@
   if (a->revision != b->revision)
     return FALSE;
 
+ if (a->uniquifier == NULL || b->uniquifier == NULL)
+ return FALSE;
+
   return strcmp(a->uniquifier, b->uniquifier) == 0;
 }
 

You can reproduce it by running the Ruby bindings test:

  % make swig-rb
  % make svnserve
  % cd binding/swig/ruby
  % test/run-test.rb -n test_transaction

Thanks,

--
kou
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=984356
Received on 2008-12-15 11:52:53 CET

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