awk leaking memory during arithmetic?

Joseph Koshy joseph.koshy at gmail.com
Mon Oct 4 19:14:11 PDT 2004


> I note that 5.2.1 and 4.10 are using different versions of awk.
> 
> Are these awk bugs, or am I misusing awk?  The memory consumption
> under 5.2.1 is what concerns me the most.  I'll open a PR, if that's

It does look like an awk bug:

$ echo | /4/usr/bin/awk '{ x = 2147483648; print $x }'
awk: cmd. line:1: (FILENAME=- FNR=1) fatal: attempt to access field -2147483648

$ echo | /4/usr/bin/awk '{ x = 2147483647; print $x }'
*blank line*


$ echo | /5/usr/bin/awk '{ x = 2147483648; print $x }'
/5/usr/bin/awk: trying to access field -2147483648
 input record number 1, file 
 source line number 1

$ echo | /5/usr/bin/awk '{ x = 2147483647; print $x }'
*core dump*


More information about the freebsd-current mailing list