develooper Front page | perl.perl5.porters | Postings from January 2017

[perl #130675] utf8.c:1418: Perl_utf8n_to_uvchr_error: Assertion `0'failed

Thread Previous
From:
Sergey Aleynikov
Date:
January 30, 2017 20:36
Subject:
[perl #130675] utf8.c:1418: Perl_utf8n_to_uvchr_error: Assertion `0'failed
Message ID:
rt-4.0.24-32469-1485808552-400.130675-75-0@perl.org
# New Ticket Created by  Sergey Aleynikov 
# Please include the string:  [perl #130675]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=130675 >


This is a bug report for perl from sergey.aleynikov@gmail.com,
generated with the help of perlbug 1.40 running under perl 5.25.9.


-----------------------------------------------------------------
[Please describe your issue here]

While fuzzing perl v5.25.9-35-g32207c637b built with afl and run
under libdislocator, I found the following 21-bytes program

% hexdump -C ../afl-asan/0051_1
00000000  42 45 47 49 4e 7b 24 5e  48 20 3d 20 2d 31 7d 79  |BEGIN{$^H = -1}y|
00000010  27 30 c1 27 27                                    |'0.''|
00000015

to cause an assertion failure. This is a regression in blead, bisect points to:

d1f8d421df731c77beff3db92d27dc6ec28589f2 is the first bad commit
commit d1f8d421df731c77beff3db92d27dc6ec28589f2
Author: Karl Williamson <khw@cpan.org>
Date:   Mon Dec 19 13:25:06 2016 -0700

    utf8.c: Forbid zero-length malformation under DEBUGGING

GDB info about the crash location:

(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58
#1  0x00007f117cd2f40a in __GI_abort () at abort.c:89
#2  0x00007f117cd26e47 in __assert_fail_base (fmt=<optimized out>,
assertion=assertion@entry=0x7f117ebb23ee "0",
file=file@entry=0x7f117ebdeefc "utf8.c",
    line=line@entry=1418, function=function@entry=0x7f117ebe3610
<__PRETTY_FUNCTION__.15300> "Perl_utf8n_to_uvchr_error") at
assert.c:92
#3  0x00007f117cd26ef2 in __GI___assert_fail
(assertion=assertion@entry=0x7f117ebb23ee "0",
file=file@entry=0x7f117ebdeefc "utf8.c", line=line@entry=1418,
    function=function@entry=0x7f117ebe3610 <__PRETTY_FUNCTION__.15300>
"Perl_utf8n_to_uvchr_error") at assert.c:101
#4  0x00007f117e9b85f3 in Perl_utf8n_to_uvchr_error (s=<optimized
out>, s@entry=0x7f117f6beca2 "", curlen=curlen@entry=0,
    retlen=retlen@entry=0x7ffd49da7d48, flags=flags@entry=0,
errors=0x7ffd49da7c3c, errors@entry=0x0) at utf8.c:1418
#5  0x00007f117e12c02e in S_pmtrans (repl=0x7f117f6beb18,
expr=<optimized out>, o=<optimized out>) at op.c:5421
#6  Perl_pmruntime (o=<optimized out>, expr=<optimized out>,
repl=0x7f117f6beb18, flags=flags@entry=1, floor=<optimized out>) at
op.c:5740
#7  0x00007f117e2b754d in Perl_yyparse (gramtype=gramtype@entry=258)
at perly.y:1204
#8  0x00007f117e172081 in S_parse_body (env=env@entry=0x0,
xsinit=xsinit@entry=0x7f117e0716c0 <xs_init>) at perl.c:2376
#9  0x00007f117e178d3b in perl_parse (my_perl=<optimized out>,
xsinit=0x7f117e0716c0 <xs_init>, argc=<optimized out>, argv=<optimized
out>, env=0x0)
    at perl.c:1691
#10 0x00007f117e07129e in main (argc=<optimized out>, argv=<optimized
out>, env=<optimized out>) at perlmain.c:121

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl 5.25.9:

Configured by root at Sat Jan 14 02:25:05 MSK 2017.

Summary of my perl5 (revision 5 version 25 subversion 9) configuration:
  Commit id: cbe2fc5001aa59cdc73e04cc35e097a2ecfbeec0
  Platform:
    osname=linux
    osvers=3.16.0-4-amd64
    archname=x86_64-linux
    uname='linux dorothy 3.16.0-4-amd64 #1 smp debian 3.16.36-1+deb8u2
(2016-10-19) x86_64 gnulinux '
    config_args='-des -Dusedevel -DDEBUGGING -Dcc=afl-clang-fast
-Doptimize=-O0 -g -ggdb3'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    bincompat5005=undef
  Compiler:
    cc='afl-clang-fast'
    ccflags ='-DDEBUGGING -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O0 -g -ggdb3'
    cppflags='-DDEBUGGING -fno-strict-aliasing -pipe
-fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='4.2.1 Compatible Clang 3.9.1 (tags/RELEASE_391/rc2)'
    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='afl-clang-fast'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/llvm-3.9/bin/../lib/clang/3.9.1/lib
/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.24.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.24'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O0 -g -ggdb3 -L/usr/local/lib -fstack-protector-strong'


---
@INC for perl 5.25.9:
    lib
    /usr/local/lib/perl5/site_perl/5.25.9/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.25.9
    /usr/local/lib/perl5/5.25.9/x86_64-linux
    /usr/local/lib/perl5/5.25.9

---
Environment for perl 5.25.9:
    HOME=/home/afl
    LANG=en_US.UTF-8
    LANGUAGE=en_US:en
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/afl/perlbrew/bin:/home/afl/perlbrew/perls/perl-5.22.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    PERLBREW_BASHRC_VERSION=0.78
    PERLBREW_HOME=/home/afl/.perlbrew
    PERLBREW_MANPATH=/home/afl/perlbrew/perls/perl-5.22.1/man
    PERLBREW_PATH=/home/afl/perlbrew/bin:/home/afl/perlbrew/perls/perl-5.22.1/bin
    PERLBREW_PERL=perl-5.22.1
    PERLBREW_ROOT=/home/afl/perlbrew
    PERLBREW_VERSION=0.78
    PERL_BADLANG (unset)
    SHELL=/usr/bin/zsh

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About