develooper Front page | perl.perl5.porters | Postings from February 2018

[perl #132892] Possibly memory leak when matching strings usingpre-compiled regexes stored in hash key (perl >= v5.26)

Thread Previous | Thread Next
From:
Sergey Aleynikov via RT
Date:
February 25, 2018 10:20
Subject:
[perl #132892] Possibly memory leak when matching strings usingpre-compiled regexes stored in hash key (perl >= v5.26)
Message ID:
rt-4.0.24-12442-1519553998-1930.132892-15-0@perl.org
On Sun, 25 Feb 2018 01:58:15 -0800, demerphq wrote:

> $ ./perl -Ilib -MDevel::Peek -le'%h=("^foo"=>1); my ($re)=keys %h;
> Dump $re'
> SV = PV(0x1009d08) at 0x103f0b8
>   REFCNT = 1
>   FLAGS = (POK,IsCOW,pPOK)
>   PV = 0x1041478 "^foo"
>   CUR = 4
>   LEN = 0
> 
> This appears to be a side-effect of shared keys.


But the failed check in regcomp.c is not *(SvEND(msv)) == 0, but rather SvLEN(msv) > SvCUR(msv). But doesn't line 3134 in hv.c (HEK_KEY(hek)[len] = 0;) guarantee that it's implicitly null-terminated, just not shown by Devel::Peek as such?

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=132892

Thread Previous | Thread Next


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