awk bugs
Richard Wescott
richw at ncrcae.UUCP
Tue Apr 15 23:58:48 AEST 1986
We have found what appears to be an bug in awk when it tries to execute the
following command:
awk '{(for(;;)}'
it reports syntax errors as it should but it also gets a segmentation
violation on our NCR TOWER machines.
Any help from the net would be greatly appreciated.
We have found and solved another bug in awk where we were getting a
segmentation violation and core dump from awk if awk was given an empty
file to read.
awk '{print $2}' /dev/null
The core dump would only occur if awk was executed from
a shell script (/bin/sh) which had many variables assigned.
The function "program" in module run.c had a register variable which
could go uninitialized if the file was empty.
Since the register was unchanged from the execution shell which exec'ed
awk the value of the register will sometimes be within the address space
for awk and other times it will not.
The fix of course was to initialize the register to NULL and check
before using it.
The following is a diff of the old and new versions of run.c:
5c5
< #define tempfree(a) {if(istemp(a)) {xfree(a->sval) ;a->tval = 0;}}
---
> #define tempfree(a) {if( a && (istemp(a))) {xfree(a->sval) ;a->tval = 0;}}
80a81
> x = NULL;
Rich Wescott
NCR E&M Columbia.
More information about the Comp.unix.wizards
mailing list