develooper Front page | perl.perl5.porters | Postings from June 2020

Asan memory leak in S_regatom

From:
Dave Mitchell
Date:
June 8, 2020 16:20
Subject:
Asan memory leak in S_regatom
Message ID:
20200608162012.GD3267@iabyn.com
Running the test suite under ASan gives failures for t/re/pat.t and
pat_thr.t

It's town to a test added for [perl #123539], and can be reduced to:

    my $r = ('x' x 255) . 'f';
    qr/$r/il;

which gives:

$ PERL_DESTRUCT_LEVEL=2 p /tmp/pat.t

=================================================================
==20351==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 2360 byte(s) in 1 object(s) allocated from:
    #0 0x50852f in calloc (/home/davem/perl5/git/bleed/perl+0x50852f)
    #1 0xb8a72e in Perl_safesyscalloc /home/davem/perl5/git/bleed/util.c:451:18
    #2 0xa91ec1 in S_regatom /home/davem/perl5/git/bleed/regcomp.c:14916:21
    #3 0xa4c1ce in S_regpiece /home/davem/perl5/git/bleed/regcomp.c:12635:11
    #4 0xa1eb70 in S_regbranch /home/davem/perl5/git/bleed/regcomp.c:12555:18
    #5 0x94c9f8 in S_reg /home/davem/perl5/git/bleed/regcomp.c:12257:10
    #6 0x8f1ba3 in Perl_re_op_compile /home/davem/perl5/git/bleed/regcomp.c:7882:9
    #7 0xfeac59 in Perl_pp_regcomp /home/davem/perl5/git/bleed/pp_ctl.c:114:14
    #8 0xb805c1 in Perl_runops_debug /home/davem/perl5/git/bleed/dump.c:2571:23
    #9 0x68151a in S_run_body /home/davem/perl5/git/bleed/perl.c:2761:2
    #10 0x67e3d9 in perl_run /home/davem/perl5/git/bleed/perl.c:2684:2
    #11 0x545345 in main /home/davem/perl5/git/bleed/perlmain.c:127:9
    #12 0x7f2db04db412 in __libc_start_main (/lib64/libc.so.6+0x24412)

Direct leak of 295 byte(s) in 1 object(s) allocated from:
    #0 0x50852f in calloc (/home/davem/perl5/git/bleed/perl+0x50852f)
    #1 0xb8a72e in Perl_safesyscalloc /home/davem/perl5/git/bleed/util.c:451:18
    #2 0xa91e6f in S_regatom /home/davem/perl5/git/bleed/regcomp.c:14915:21
    #3 0xa4c1ce in S_regpiece /home/davem/perl5/git/bleed/regcomp.c:12635:11
    #4 0xa1eb70 in S_regbranch /home/davem/perl5/git/bleed/regcomp.c:12555:18
    #5 0x94c9f8 in S_reg /home/davem/perl5/git/bleed/regcomp.c:12257:10
    #6 0x8f1ba3 in Perl_re_op_compile /home/davem/perl5/git/bleed/regcomp.c:7882:9
    #7 0xfeac59 in Perl_pp_regcomp /home/davem/perl5/git/bleed/pp_ctl.c:114:14
    #8 0xb805c1 in Perl_runops_debug /home/davem/perl5/git/bleed/dump.c:2571:23
    #9 0x68151a in S_run_body /home/davem/perl5/git/bleed/perl.c:2761:2
    #10 0x67e3d9 in perl_run /home/davem/perl5/git/bleed/perl.c:2684:2
    #11 0x545345 in main /home/davem/perl5/git/bleed/perlmain.c:127:9
    #12 0x7f2db04db412 in __libc_start_main (/lib64/libc.so.6+0x24412)

SUMMARY: AddressSanitizer: 2655 byte(s) leaked in 2 allocation(s).

I don't intend to look further.

-- 
The Enterprise successfully ferries an alien VIP from one place to another
without serious incident.
    -- Things That Never Happen in "Star Trek" #7



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