Hi,

I just tracked down the SIGSEGV/SIGBUS bug on my system: the following happens
on my system in gwcache.c (watch the stacktrace):

---
gwc_retrieve () at gwcache.c:267
267             file_path_set(&fpvec[0], settings_config_dir(), gwc_file);
(gdb) bt
#0  gwc_retrieve () at gwcache.c:267
#1  0x810d003 in gwc_init () at gwcache.c:369
#2  0x80ec579 in main (argc=1, argv=0xbfbff45c, env=0xbfbff464) at main.c:420
#3  0x806435f in _start ()
(gdb) n
268             file_path_set(&fpvec[1], PACKAGE_DATA_DIR, gwc_bootfile);
(gdb) bt
#0  gwc_retrieve () at gwcache.c:268
#1  0x810d003 in gwc_init () at gwcache.c:369
#2  0x80ec579 in main (argc=1, argv=0xbfbff45c, env=0xbfbff464) at main.c:420
#3  0x806435f in _start ()
(gdb) n
270             file_path_set(&fpvec[2], PACKAGE_SOURCE_DIR, gwc_bootfile);
(gdb) bt
#0  gwc_retrieve () at gwcache.c:270
#1  0x810d003 in gwc_init () at gwcache.c:369
#2  0x80ec579 in main (argc=1, argv=0xbfbff45c, env=0xbfbff464) at main.c:420
#3  0x806435f in _start ()
(gdb) n
273             in = file_config_open_read(gwc_what, fpvec, G_N_ELEMENTS(fpvec));
(gdb) bt
#0  gwc_retrieve () at gwcache.c:273
#1  0x81523c4 in rcsid ()
#2  0x63732f65 in ?? ()
Error accessing memory address 0x6d6f682f: Bad address.
---

As can be seen from the sourcecode, fpvec[2] is not valid when
USE_SOURCE_DIR_AS_FALLBACK is set (two lines are swapped).


The following simple patch fixes that problem:


Index: gwcache.c
===================================================================
RCS file: /cvsroot/gtk-gnutella/gtk-gnutella-current/src/gwcache.c,v
retrieving revision 1.38
diff -c -r1.38 gwcache.c
*** gwcache.c   18 Jul 2003 05:07:45 -0000      1.38
--- gwcache.c   22 Jul 2003 18:14:12 -0000
***************
*** 258,266 ****
        gint line;
        FILE *in;
  #ifdef USE_SOURCE_DIR_AS_FALLBACK
-       file_path_t fpvec[2];
- #else
        file_path_t fpvec[3];
  #endif
        gchar tmp[1024];
  
--- 258,266 ----
        gint line;
        FILE *in;
  #ifdef USE_SOURCE_DIR_AS_FALLBACK
        file_path_t fpvec[3];
+ #else
+       file_path_t fpvec[2];
  #endif
        gchar tmp[1024];
  

Greetings,
Thomas.


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
Gtk-gnutella-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel

Reply via email to