Skip Menu |
Report information
Id: 128171
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: dcollinsn [at] gmail.com
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: unknown
Perl Version: (no value)
Fixed In: (no value)



Subject: Assert fail in toke.c postderef code with no other symptoms: /@0{0*->@/*0
Download (untitled) / with headers
text/plain 6.8k
Greetings Porters, I have compiled bleadperl with the afl-gcc compiler using: ./Configure -Dusedevel -Dprefix='/usr/local/perl-afl' -Dcc='ccache afl-gcc' -Uuselongdouble -Duse64bitall -Doptimize=-g -Uversiononly -Uman1dir -Uman3dir -Dusequadmath -des AFL_HARDEN=1 make && make test And then fuzzed the resulting binary using: AFL_NO_VAR_CHECK=1 afl-fuzz -i in -o out bin/perl @@ After reducing testcases using `afl-tmin` and performing additional minimization by hand, I have located the following testcase that triggers an assert fail in debugging builds of the perl interpreter. The testcase is the 6-character file: /@0{0*->@/*0 On normal builds, this exits with the expected error. On debug builds, this returns an assert fail. dcollins@nightshade64:~$ ./perldebug/miniperl -e '/@0{0*->@/*0' miniperl: toke.c:1935: S_postderef: Assertion `strchr("*[{", next)' failed. Aborted dcollins@nightshade64:~$ ./perl/miniperl -e '/@0{0*->@/*0' Number found where operator expected at -e line 1, near "*0" (Missing operator before 0?) syntax error at -e line 1, near "*->" Execution of -e aborted due to compilation errors. Debugging tool output is below. A bisect was performed, but it appears that this bug has existed since the feature was initally committed (and is only appearing now because "use feature postderef" was a bit too much to expect a fuzzer to stumble on easily). **GDB** dcollins@nightshade64:~/perldebug$ gdb --args ./miniperl -e '/@0{0*->@/*0' GNU gdb (GDB) 7.10 Copyright (C) 2015 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-unknown-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./miniperl...done. (gdb) run Starting program: /home/dcollins/perldebug/miniperl -e /@0\{0\*-\>@/\*0 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". miniperl: toke.c:1935: S_postderef: Assertion `strchr("*[{", next)' failed. Program received signal SIGABRT, Aborted. 0x00007ffff6cf9478 in raise () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) bt #0 0x00007ffff6cf9478 in raise () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007ffff6cfa8fa in abort () from /lib/x86_64-linux-gnu/libc.so.6 #2 0x00007ffff6cf23a7 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 #3 0x00007ffff6cf2452 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6 #4 0x000000000047c77f in S_postderef (funny=42, next=48 '0') at toke.c:1935 #5 0x000000000048f4e1 in Perl_yylex () at toke.c:5373 #6 0x00000000004b9f00 in Perl_yyparse (gramtype=258) at perly.c:332 #7 0x0000000000447469 in S_parse_body (env=0x0, xsinit=0x728923 <xs_init>) at perl.c:2365 #8 0x0000000000445f07 in perl_parse (my_perl=0xa80010, xsinit=0x728923 <xs_init>, argc=3, argv=0x7fffffffe628, env=0x0) at perl.c:1681 #9 0x0000000000728882 in main (argc=3, argv=0x7fffffffe628, env=0x7fffffffe648) at miniperlmain.c:120 (gdb) f 4 #4 0x000000000047c77f in S_postderef (funny=42, next=48 '0') at toke.c:1935 1935 assert(strchr("*[{", next)); (gdb) l 1930 1931 static int 1932 S_postderef(pTHX_ int const funny, char const next) 1933 { 1934 assert(funny == DOLSHARP || strchr("$@%&*", funny)); 1935 assert(strchr("*[{", next)); 1936 if (next == '*') { 1937 PL_expect = XOPERATOR; 1938 if (PL_lex_state == LEX_INTERPNORMAL && !PL_lex_brackets) { 1939 assert('@' == funny || '$' == funny || DOLSHARP == funny); (gdb) info locals __PRETTY_FUNCTION__ = "S_postderef" **PERL -V** dcollins@nightshade64:~/perl$ ./perl -Ilib -V Summary of my perl5 (revision 5 version 25 subversion 1) configuration: Commit id: 8255316ac82c0fbd7ae49f2f9a217ce063d7bbfb Platform: osname=linux, osvers=4.5.0-2-amd64, archname=x86_64-linux-ld uname='linux nightshade64 4.5.0-2-amd64 #1 smp debian 4.5.3-2 (2016-05-08) x86_64 gnulinux ' config_args='-Dusedevel -Dprefix=/usr/local/perl-afl -Dcc=ccache afl-gcc -Duselongdouble -Duse64bitall -Doptimize=-g -Uversiononly -Uman1dir -Uman3dir -des' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef use64bitint=define, use64bitall=define, uselongdouble=define usemymalloc=n, bincompat5005=undef Compiler: cc='ccache afl-gcc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-g', cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include' ccversion='', gccversion='6.1.0', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3 ivtype='long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8 alignbytes=16, prototype=define Linker and Libraries: ld='ccache afl-gcc', ldflags =' -fstack-protector-strong -L/usr/local/lib' libpth=/usr/local/lib /usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.22.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.22' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -g -L/usr/local/lib -fstack-protector-strong' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP PERL_OP_PARENT PERL_PRESERVE_IVUV PERL_USE_DEVEL USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF Built under linux Compiled at May 16 2016 07:45:27 @INC: lib /usr/local/perl-afl/lib/site_perl/5.25.1/x86_64-linux-ld /usr/local/perl-afl/lib/site_perl/5.25.1 /usr/local/perl-afl/lib/5.25.1/x86_64-linux-ld /usr/local/perl-afl/lib/5.25.1 /usr/local/perl-afl/lib/site_perl/5.24.0 /usr/local/perl-afl/lib/site_perl .
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 798b
On Tue May 17 17:00:26 2016, dcollinsn@gmail.com wrote: Show quoted text
> Greetings Porters, > > I have compiled bleadperl with the afl-gcc compiler using: > > ./Configure -Dusedevel -Dprefix='/usr/local/perl-afl' -Dcc='ccache > afl-gcc' -Uuselongdouble -Duse64bitall -Doptimize=-g -Uversiononly > -Uman1dir -Uman3dir -Dusequadmath -des > AFL_HARDEN=1 make && make test > > And then fuzzed the resulting binary using: > > AFL_NO_VAR_CHECK=1 afl-fuzz -i in -o out bin/perl @@ > > After reducing testcases using `afl-tmin` and performing additional > minimization by hand, I have located the following testcase that > triggers an assert fail in debugging builds of the perl interpreter. > The testcase is the 6-character file: > > /@0{0*->@/*0
Thank you. This is fixed in d6744494. -- Father Chrysostomos
Download (untitled) / with headers
text/plain 313b
Thank you for filing this report. You have helped make Perl better. With the release today of Perl 5.26.0, this and 210 other issues have been resolved. Perl 5.26.0 may be downloaded via: https://metacpan.org/release/XSAWYERX/perl-5.26.0 If you find that the problem persists, feel free to reopen this ticket.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org