develooper Front page | perl.perl5.porters | Postings from December 2011

[perl #104034] perl with usemymalloc='y' fails to compile after commit 70b71ec

Thread Previous
From:
Peter Martini via RT
Date:
December 3, 2011 04:24
Subject:
[perl #104034] perl with usemymalloc='y' fails to compile after commit 70b71ec
Message ID:
rt-3.6.HEAD-5084-1322915090-808.104034-14-0@perl.org
So, I've worked out the issue (thanks to the previous updaters for
locating the bug).

sv_usepvn_flags is documented as expecting a pointer to malloced memory,
and since perl's malloc does its accounting in line, will neither
operate properly nor die cleanly if its passed a pointer to memory that
isn't an address that it handed out to the rest of perl at some point. 
Specifically, if RCHECK is on, it maintains a guard value to make sure
that illegitimate memory isn't being used, and since that guard value is
written outside of the memory its allocating, its overwriting some
essentially random address in memory.

Considering what sv_sethek needs from sv_usepvn_flags - just the
SV_CHECK_THINKFIRST_COW_DROP, SvPV_set, SvCUR_set (since SvLEN_set is
overwritten immediately after the call anyway), and SvTAINT (although I
admit I don't know if this is necessary), inlining those calls into
sv_sethek directly instead of via sv_usepvn_flags gets my perl to build
again, and make test finds all tests pass.

Attached is a patch.

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