This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: Assert that we don’t overflow token stack
authorFather Chrysostomos <sprout@cpan.org>
Mon, 9 Feb 2015 04:24:15 +0000 (20:24 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 9 Feb 2015 04:24:15 +0000 (20:24 -0800)
With this assertion, the test case from #123743 fails sooner.

toke.c

diff --git a/toke.c b/toke.c
index 388b272..2df7732 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1907,6 +1907,7 @@ S_force_next(pTHX_ I32 type)
        tokereport(type, &NEXTVAL_NEXTTOKE);
     }
 #endif
+    assert(PL_nexttoke < C_ARRAY_LENGTH(PL_nexttype));
     PL_nexttype[PL_nexttoke] = type;
     PL_nexttoke++;
     if (PL_lex_state != LEX_KNOWNEXT) {