Subject: Re: sed drops core
To: Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>
From: Havard Eidnes <Havard.Eidnes@runit.sintef.no>
List: current-users
Date: 11/20/1993 23:56:28
> I've just looked with gdb and did the following change:
>
> *** usr.bin/sed/compile.c- Sun Nov 7 11:09:33 1993
> --- usr.bin/sed/compile.c Sat Nov 20 22:44:12 1993
> ***************
> *** 209,214 ****
> --- 209,215 ----
> p = NULL;
> cmd2 = xmalloc(sizeof(struct s_command));
> cmd2->code = '}';
> + cmd2->a1 = cmd2->a2 = NULL;
> *compile_stream("}", &cmd->u.c, p) = cmd2;
> cmd->next = cmd2;
> link = &cmd2->next;
This does not cure all the accesses to uninitialized memory. I just undid
my fix and applied this, and I still get messages about accesses to un-
initialized memory. It appears that you also need to add a
cmd2->nonsel = 0;
after the initialization in your patch above. After I did this, the errors
about access to uninitialized memory vanished in my test case
(makewhatis.sed on ls.0).
There's possibly an 8-byte memory leak resulting from the xmalloc() in
add_file(), line 347 of main.c in my test run as well, but that's picking
nits...
You may want to re-submit with this added modification (I admit the bzero()
was a brute-force fix).
- Havard
------------------------------------------------------------------------------