diff options
author | Nicholas Clark <nick@ccl4.org> | 2013-03-25 13:06:09 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2013-03-25 21:19:36 +0100 |
commit | 1b77350017006d9e581d4eda49c59b68e408f51b (patch) | |
tree | 410aa761dad94946e7a50009b517f51860623888 /minimod.pl | |
parent | 6bf48f47bbdbe4838b70d67830ead4ebc3d318d4 (diff) | |
download | perl-1b77350017006d9e581d4eda49c59b68e408f51b.tar.gz |
xs_init() must pass a static char* when creating &DynaLoader::boot_DynaLoader.
newXS() assumes that the passed pointer to the filename is in static storage,
or otherwise will outlive the PVCV that it is about to create, and hence that
it's safe to copy the pointer, not the value, to CvFILE. Hence xs_init()
must not use an auto array to "store" the filename, as that will be on the
stack, and becomes invalid as soon as xs_init() returns. The analogous bug
fix was made in universal.c by commit 157e3fc8c802010d in Feb 2006.
Spotted by compiling for ithreads with gcc 4.8.0's ASAN and running
dist/B-Deparse/t/deparse.t
Diffstat (limited to 'minimod.pl')
-rw-r--r-- | minimod.pl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/minimod.pl b/minimod.pl index a5bd172204..a59b7f202b 100644 --- a/minimod.pl +++ b/minimod.pl @@ -71,7 +71,7 @@ sub writemain{ my ($tail1,$tail2,$tail3) = ( $tail =~ /\A(.*{\s*\n)(.*\n)(\s*\}.*)\Z/s ); print $tail1; - print "\tconst char file[] = __FILE__;\n"; + print "\tstatic const char file[] = __FILE__;\n"; print "\tdXSUB_SYS;\n" if $] > 5.002; print $tail2; |