bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Function argument corruption in 4.2.0


From: Andrew J. Schorr
Subject: Re: [bug-gawk] Function argument corruption in 4.2.0
Date: Mon, 13 Nov 2017 14:46:10 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Nov 13, 2017 at 02:35:47PM -0500, Andrew J. Schorr wrote:
> On Mon, Nov 13, 2017 at 02:30:51PM -0500, Andrew J. Schorr wrote:
> > Surprisingly, I get an assertion failure when I run your script using
> > the gawk 4.2 stable branch:
> > 
> > bash$ gawk -We mdlint test.in -v -r label_exists_for_destination
> > gawk: field.c:350: purge_record: Assertion `(fields_arr[i]->flags & 0x0001) 
> > == 0 ? fields_arr[i]->sub.val.sref == 1 : 1' failed.
> > Abort (core dumped)
> > 
> > I wonder why that doesn't happen to you...
> 
> Sorry, duh, you obviously wouldn't have it compiled with assertions enabled.
> For that, you would need to "touch .developing" before running configure.  At
> least this provides a clue about where things are going off the rails.

FYI, with the assertion disabled, we do get a valgrind error down the road:

bash$ valgrind gawk -f mdlint < small.in
==6219== Memcheck, a memory error detector
==6219== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==6219== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==6219== Command: /home/users/schorr/src/awk/master/gawk -f mdlint
==6219== 
oops: valref = 2
==6219== Invalid read of size 1
==6219==    at 0x4C2E240: memcpy@@GLIBC_2.14 (vg_replace_strmem.c:1018)
==6219==    by 0x420D52: format_tree (builtin.c:1468)
==6219==    by 0x423621: printf_common (builtin.c:1639)
==6219==    by 0x4236B1: do_sprintf (builtin.c:1655)
==6219==    by 0x4403D5: r_interpret (interpret.h:962)
==6219==    by 0x40DA59: main (main.c:505)
==6219==  Address 0xcc99120 is 0 bytes inside a block of size 32 free'd
==6219==    at 0x4C2ACDD: free (vg_replace_malloc.c:530)
==6219==    by 0x45F338: r_unref (node.c:480)
==6219==    by 0x4436B9: unref (awk.h:1887)
==6219==    by 0x4436B9: r_interpret (interpret.h:702)
==6219==    by 0x40DA59: main (main.c:505)
==6219==  Block was alloc'd at
==6219==    at 0x4C29BE3: malloc (vg_replace_malloc.c:299)
==6219==    by 0x45FF94: emalloc_real (awk.h:1950)
==6219==    by 0x45FF94: make_str_node (node.c:386)
==6219==    by 0x424210: do_substr (builtin.c:1869)
==6219==    by 0x4403D5: r_interpret (interpret.h:962)
==6219==    by 0x40DA59: main (main.c:505)
...

Regards,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]