bug-gawk
[Top][All Lists]
Advanced

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

Re: Test suite failures under UndefinedBehaviorSanitizer (UBSAN)


From: arnold
Subject: Re: Test suite failures under UndefinedBehaviorSanitizer (UBSAN)
Date: Sun, 05 Feb 2023 08:54:00 -0700
User-agent: Heirloom mailx 12.5 7/5/10

Hi.

I found some time to look into this more. Attached is a patch
that fixes the problem. I will push it to Git very shortly.

Thanks,

Arnold

Sam James <sam@gentoo.org> wrote:

> > On 1 Jan 2023, at 18:50, arnold@skeeve.com wrote:
> > 
> > Hi.
> > 
> > Thank you for the bug report, and in particular for using the
> > gawkbug script.
> > 
> > I took a walk through the code.  I don't think that your patch
> > is correct -- the returned cnt should either be positive or
> > negative all the time, but if there was an error we want
> > to report it and then return the value.  errcode is initialized
> > to zero before being passed to get_a_record, so if it comes
> > back non-zero, we know something bad happened.
> > 
>
> Yeah, I see what you mean now. But in any case, s is still
> null on that last run (confirmed with gdb, as UBSAN originally reported).
>
> get_a_record is the last place to touch s before that, so it must
> be something in there which sets it to null but doesn't affect the error code?
>
> Or am I missing something?
>
> Let me know if you have trouble reproducing the original
> UBSAN traceback too, for me, this was enough:
> ```
> ./bootstrap.sh
> ./configure CC=gcc CFLAGS="-O2 -fsanitize=undefined -ggdb3" CXXFLAGS="-O2 
> -fsanitize=undefined -ggdb3"
> make
> export UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1
> make check
> ./gawk -v SRCDIR=$(pwd)/test -f test/pipeio2.awk
> ```
>
> Best,
> sam

Attachment: ub-fix.diff
Description: Text document


reply via email to

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