Friday, June 29, 2012

These are not the bugs you are looking for

There is something vaguely frustrating about finding and fixing a bug in some software thinking that you have found your problem and things will start working right only to find that the problem is still there - you found a bug but not the one you were searching for.

I had this today, I have been off and on trying to track down why aspell seg faults when NetBSD curses is used, the problem has the hallmarks of memory being overwritten.  I built a version of libcurses with dmalloc and it was telling me that a boundary was being overrun.  After a bit of digging I found that in __init_get_wch there was a memset used to clear a buffer but the size argument was way too big causing memset to stomp past the end of the array.  I fixed this and dmalloc no longer complained when I ran my simple test code but aspell still seg faults and the stack backtrace from the core file still looks as mangled as it did before my fix.  So, yes, I definitely fixed a bug - just not the one I was aiming to fix.

No comments: