rurban / re-engine-PCRE2

use pcre-jit instead of slow perl regex
Other
1 stars 4 forks source link

asan PCRE2_make_nametable heap-buffer-overflow #10

Closed rurban closed 7 years ago

rurban commented 7 years ago

with duplicate names in make_nametable:

# gdba cperl5.26.0d-nt-asan -Mblib -Mre::engine::PCRE2 -e'"snofooewa" =~ /(?<n>foo)|(?<n>bar)|(?<n>baz)/'
b PCRE2_make_nametable

==40795==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000027014 at pc 0x000111b1cbd9 bp 0x7fff5221c430 sp 0x7fff5221c428
READ of size 4 at 0x602000027014 thread T0
    #0 0x111b1cbd8 in PCRE2_make_nametable /Users/rurban/Perl/re-engine-PCRE2/PCRE2.xs:440:21
    #1 0x111b1a722 in PCRE2_comp /Users/rurban/Perl/re-engine-PCRE2/PCRE2.xs:211:9
    #2 0x10da014db in Perl_pmruntime (/usr/local/bin/cperl5.26.0d-nt-asan+0x10001f4db)
    #3 0x10db65e2e in Perl_yyparse (/usr/local/bin/cperl5.26.0d-nt-asan+0x100183e2e)
    #4 0x10da7e6da in S_parse_body (/usr/local/bin/cperl5.26.0d-nt-asan+0x10009c6da)
    #5 0x10da77cba in perl_parse (/usr/local/bin/cperl5.26.0d-nt-asan+0x100095cba)
    #6 0x10d9e37ac  (/usr/local/bin/cperl5.26.0d-nt-asan+0x1000017ac)
    #7 0x7fff960545ac  (/usr/lib/system/libdyld.dylib+0x35ac)
rurban commented 7 years ago

Closed with ef02f1928c152ebb975d568808817999413ce6de