Current Scid from CVS; GNU/Linux, amd64

When I try to replace a certain game in a database, Scid crashes
immediately with segmentation fault when I press Ctrl-r.  I've found the
problem is here in src/strtree.h, line 618:

  template <class C>
  uint
  StrTree<C>::GetFirstMatches (const char * str, uint maxMatches,
                               nodeT<C> ** array)
  {
      ASSERT (array != NULL  &&  maxMatches > 0);
      if (! TreeMode) { MakeTree(); }
      uint matches = 0;
->    nodeT<C> * root = Root[(uint) *str];
      FindMatches (str, strlen(str), root, &matches, maxMatches, array);
      return matches;
  }

gdb says:

  (gdb) p str
  $3 = 0x20f1150 "Šumavská"
  (gdb) p *str
  $5 = -59 '\305'
  (gdb) p (uint)*str
  $6 = 4294967237

$3 and $5 are fine (str[0] is a non-ASCII Czech character), $6 is
clearly not fine.  The following patch fixes the problem:

Index: strtree.h
===================================================================
RCS file: /cvsroot/scid/scid/src/strtree.h,v
retrieving revision 1.3
diff -u -r1.3 strtree.h
--- strtree.h	22 Jun 2008 21:46:47 -0000	1.3
+++ strtree.h	6 Nov 2010 20:35:59 -0000
@@ -615,7 +615,7 @@
     ASSERT (array != NULL  &&  maxMatches > 0);
     if (! TreeMode) { MakeTree(); }
     uint matches = 0;
-    nodeT<C> * root = Root[(uint) *str];
+    nodeT<C> * root = Root[(byte) *str];
     FindMatches (str, strlen(str), root, &matches, maxMatches, array);
     return matches;
 }
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Scid-users mailing list
Scid-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scid-users

Reply via email to