# New Ticket Created by Hugo van der Sanden # Please include the string: [perl #130198] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=130198 > This is a bug report for perl from hv@crypt.org, generated with the help of perlbug 1.40 running under perl 5.25.7. ----------------------------------------------------------------- [Please describe your issue here] In [perl #124368], Brian reports a second unrelated AFL-generated case that happens to hit the same assertion in Perl_sv_2pv_flags(); in short: % perl -e 'chop(@x =~ tr/1/1/)' perl: sv.c:2941: Perl_sv_2pv_flags: Assertion `((svtype)((sv)->sv_flags & 0xff)) != SVt_PVAV && ((svtype)((sv)->sv_flags & 0xff)) != SVt_PVHV && ((svtype)((sv)->sv_flags & 0xff)) != SVt_PVFM' failed. Aborted (core dumped) % Without -DDEBUGGING: % ./miniperl -wle '@x=(1..11); print scalar @x; print @x =~ tr/1/1/; print chop(@x =~ tr/1/1/)' Applying transliteration (tr///) to @x will act on scalar(@x) at -e line 1. Applying transliteration (tr///) to @x will act on scalar(@x) at -e line 1. 11 2 Use of uninitialized value in transliteration (tr///) at -e line 1. 0 % The same works fine on a string, apparently happy to chop the temp scalar: % ./miniperl -wle '$s="11"; print $s; print $s =~ tr/1/1/; print chop($s =~ tr/1/1/)' 11 2 2 % .. but I note that if you throw a scalar() in there (which I'd have expected to have no effect), both cases complain (and in rather dodgy style): % ./miniperl -wle '@x=(1..11); chop(scalar(@x) =~ tr/1/1/)' Can't modify scalar in chop at -e line 1, near "tr/1/1/) " Execution of -e aborted due to compilation errors. % ./miniperl -wle '$s="11"; chop(scalar($s) =~ tr/1/1/)' Can't modify scalar in chop at -e line 1, near "tr/1/1/) " Execution of -e aborted due to compilation errors. % I'm not sure now what correct behaviour would be here, or how to make it so. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.25.7: Configured by hv at Wed Nov 9 13:58:26 GMT 2016. Summary of my perl5 (revision 5 version 25 subversion 7) configuration: Commit id: 392582f8c00033c1199d338baf72f42bbd9ef2dc Platform: osname=linux osvers=3.13.0-37-generic archname=x86_64-linux uname='linux shad2 3.13.0-37-generic #64-ubuntu smp mon sep 22 21:28:38 utc 2014 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Dcc=gcc -Dprefix=/opt/blead-d0 -Doptimize=-g -O0 -DDEBUGGING -Dusedevel -Uversiononly' hint=recommended useposix=true d_sigaction=define useithreads=undef usemultiplicity=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n bincompat5005=undef Compiler: cc='gcc' ccflags ='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2' optimize='-g -O0' cppflags='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='' gccversion='4.8.4' 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='double' nvsize=8 Off_t='off_t' lseeksize=8 alignbytes=8 prototype=define Linker and Libraries: ld='gcc' ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.8/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 /lib64 /usr/lib64 libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.19.so so=so useshrplib=false libperl=libperl.a gnulibc_version='2.19' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=so d_dlsymun=undef ccdlflags='-Wl,-E' cccdlflags='-fPIC' lddlflags='-shared -g -O0 -L/usr/local/lib -fstack-protector' --- @INC for perl 5.25.7: /opt/blead-d0/lib/perl5/site_perl/5.25.7/x86_64-linux /opt/blead-d0/lib/perl5/site_perl/5.25.7 /opt/blead-d0/lib/perl5/5.25.7/x86_64-linux /opt/blead-d0/lib/perl5/5.25.7 --- Environment for perl 5.25.7: HOME=/home/hv LANG=C LANGUAGE=en_GB:en LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/hv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PERL_BADLANG (unset) SHELL=/bin/bash