diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-06-12 21:13:14 +0100 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2010-08-23 19:14:43 -0500 |
commit | 81d65e2b731b0dc785456578fd92e34a27a1c670 (patch) | |
tree | bee9f3a9d5afb620633db33230ba80d5c8c0654b | |
parent | 697790afdcc31ef010b4361b36bfb23c8e798c25 (diff) | |
download | perl-81d65e2b731b0dc785456578fd92e34a27a1c670.tar.gz |
Fix edge case in pp_eof where the stack extent was not checked.
Analogous to pp_getc and pp_tell in ac3697cd90b00fae, pp_eof has a conditional
POP from the stack, but an unconditional PUSH to the stack, but no check that
the stack had space for the PUSH. This bug has been present since perl 5.000.
(with slight tweak for maint to avoid tripping over the absence of 099be4f)
-rw-r--r-- | pp_sys.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -2019,10 +2019,14 @@ PP(pp_eof) if (MAXARG) gv = PL_last_in_gv = MUTABLE_GV(POPs); /* eof(FH) */ - else if (PL_op->op_flags & OPf_SPECIAL) - gv = PL_last_in_gv = GvEGV(PL_argvgv); /* eof() - ARGV magic */ - else - gv = PL_last_in_gv; /* eof */ + else { + EXTEND(SP, 1); + + if (PL_op->op_flags & OPf_SPECIAL) + gv = PL_last_in_gv = GvEGV(PL_argvgv); /* eof() - ARGV magic */ + else + gv = PL_last_in_gv; /* eof */ + } if (!gv) RETPUSHNO; |