[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] Bus errors on MacOS X with 2.0.0.alpha20030209a

Jari Lehtonen <jari@xxxxxx> writes:

> today I was forced to rebuild my news spool (a disk problem, don't ask...)
> and decided to try a new leafnode version. I've been previously running
> 2.0b8_ma10pre2. 
> However, when I tried the initial fetchnews, all I got was a bus error and
> some crash dumps. Here's a gdb output of the crash. I'm running on Mac OS X
> 10.2.4:

> Program received signal EXC_BAD_ACCESS, Could not access memory.

Hum. This doesn't have debug information for the system. However...

> #4  0x000140d0 in my_sort (base=0x7ab20, nmemb=0, size=28, compar=0x6b00
> <compactive>, file=0x1dad0 "activutil.c", line=197) at sort.c:49

This looks suspiciously as though your mergesort() function was hosed
and didn't handle nmemb == 0 and crashed.

Please let me know if this patch helps. If it does, your mergesort()
function is hosed. If it does not help, I'll have to dig somewhere else
in the leafnode code for the bug.

Index: sort.c
RCS file: /var/CVS/leafnode-2/sort.c,v
retrieving revision 1.4
diff -u -r1.4 sort.c
--- sort.c	19 Jan 2002 02:12:02 -0000	1.4
+++ sort.c	7 Mar 2003 03:48:16 -0000
@@ -28,6 +28,7 @@
 	compare = 0;
 	cmp = compar;
+	if (nmemb < 2) return;
 	if (mergesort(base, nmemb, size, cmphook)) {
 		   "quicksort(base=%p, nmemb=%lu, "
@@ -46,6 +47,7 @@
 	       file, line);
     } else {
 	/* not in debug mode */
+	if (nmemb < 2) return;
 	if (mergesort(base, nmemb, size, compar)) {
 	    qsort(base, nmemb, size, compar);

Matthias Andree
leafnode-1 download: http://sourceforge.net/projects/leafnode/
leafnode-1 docs/new: http://mandree.home.pages.de/leafnode/
leafnode-2 homepage: http://mandree.home.pages.de/leafnode/beta/

leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list