summaryrefslogtreecommitdiff
path: root/perly.y
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2010-05-01 17:30:26 +0100
committerDavid Golden <dagolden@cpan.org>2010-05-20 18:56:11 -0400
commitaf5050ac60ae083ebc5a0b2a1b4289c51c622f95 (patch)
treeb4d5a78625ea9b53923f18ad6a8ceb5756c09bfc /perly.y
parent4e4da3acc11d96d134ed1dc0effd641e7bedb0ca (diff)
downloadperl-af5050ac60ae083ebc5a0b2a1b4289c51c622f95.tar.gz
fix SEGV with eval("package Foo {")
OPs relating to the package name and version were subject to double freeing during error recovery from an incomplete package block. Fixed by using the op_latefree mechanism to shift the op free time.
Diffstat (limited to 'perly.y')
-rw-r--r--perly.y12
1 files changed, 11 insertions, 1 deletions
diff --git a/perly.y b/perly.y
index 691ae94fed..dcb6114d31 100644
--- a/perly.y
+++ b/perly.y
@@ -667,9 +667,16 @@ package : PACKAGE WORD WORD ';'
package_block: PACKAGE WORD WORD '{' remember
{
+ int save_3_latefree = $3->op_latefree;
+ $3->op_latefree = 1;
package($3);
- if ($2)
+ $3->op_latefree = save_3_latefree;
+ if ($2) {
+ int save_2_latefree = $2->op_latefree;
+ $2->op_latefree = 1;
package_version($2);
+ $2->op_latefree = save_2_latefree;
+ }
}
lineseq '}'
{ if (PL_parser->copline > (line_t)IVAL($4))
@@ -677,6 +684,9 @@ package_block: PACKAGE WORD WORD '{' remember
$$ = block_end($5, $7);
TOKEN_GETMAD($4,$$,'{');
TOKEN_GETMAD($8,$$,'}');
+ op_free($3);
+ if ($2)
+ op_free($2);
}
;