FIX FOR SEGMENTATION FAULT


To <ng-spice-devel@ieee.ing.uniroma1.it>,<ng-spice-bugs@ieee.ing.uniroma1.it>
From "Jon Engelbert" <jon@beigebag.com>
Date Thu, 26 Jul 2001 11:06:33 -0400
Delivered-To mailing list ng-spice-devel@ieee.ing.uniroma1.it
Importance Normal
In-Reply-To <Pine.LNX.3.96.1010626162533.11950C-100000@ieee.ing.uniroma1.it >
Mailing-List contact ng-spice-devel-help@ieee.ing.uniroma1.it; run by ezmlm
Reply-To ng-spice-devel@ieee.ing.uniroma1.it

ifnewuid.c,
        if ( (newname = (char *) malloc(strlen((char *) olduid) +
strlen(suffix) + 2)) == NULL)
The "2" is for the pound sign ('#') and for the end of string ('\0').
Strlen("#\0") returns 1.
Previously, it was one character short.  It needs the character for end of
string (\0)... the way it's written was confusing and evil.
I found this after hours of debugging.  I found a tool on the university of
Oregon web-site that proved very useful.  It's two files, mm.h and mm.c.
Here's some info from its header file.
*
 * Memory Manager Debugger Library Header file
 *
 * Prefix: mm, none
 * $Id: mm.h,v 1.7 2000/01/03 23:19:58 clements Exp $
 * $Source: /misc/projects/CIRL/CVS/include/mm.h,v $
 *
 *
 *
 * MEMORY MANAGEMENT DEBUGGER LIBRARY
 * ----------------------------------
 *
 * The memory management debugger library remaps the standard memory
allocation
 * and free routines to equivalent routines that do additional error
checking
 * and bookkeeping.  The library also contains routines that print out or
 * validate the current state of memory allocations.
 *
 *
 *
 * MM_DEBUG
 * --------
 *
 * The remapping of standard memory allocation & free routines is done only
 * if MM_DEBUG is #defined.  The other support routines are also only
 * called if MM_DEBUG is #defined.  See USAGE and un USAGE below.
 *
Jon Engelbert
President, Beige Bag Software
279 E. Liberty, Ann Arbor, MI 48105
jon@beigebag.com

-----Original Message-----
From: p.nenzi@ieee.org [mailto:pnenzi@ieee.ing.uniroma1.it]
Sent: Tuesday, June 26, 2001 10:26 AM
To: ng-spice-devel@ieee.ing.uniroma1.it
Subject: [ng-spice-devel] [ng-spice-bugs] Again segmentation fault in
realloc (fwd)


---------- Forwarded message ----------
Date: Tue, 26 Jun 2001 13:33:37 +0200
From: Thomas.Budmiger@flowtec.endress.com
Reply-To: ng-spice-bugs@ieee.ing.uniroma1.it
To: ng-spice-bugs@ieee.ing.uniroma1.it
Subject: [ng-spice-bugs] Again segmentation fault in realloc

Hello

Some more informations to my mail from yesterday:

1.   It is glibc release 2.2.2
2.   A first crash occures in "ivars.c" at the end of the function "ivars".
The program doesn't survive
     the atoi function call... This happens only when the garbage collector
is not in use.
     After commenting out this line, the program behaves as described
yesterday.

I'll try to find out more details, nevertheless, any experience with this
problem (or fixes already on
somebody's machine) would be very helpful. Thank you.

Thomas Budmiger

thomas.budmiger@flowtec.endress.com
thomas.budmiger@datacomm.ch


Partial thread listing: