5d6a5ae
From 9bde56224e82f20e7a65b3469b1ffb6b9f6d4df8 Mon Sep 17 00:00:00 2001
5d6a5ae
From: Father Chrysostomos <sprout@cpan.org>
5d6a5ae
Date: Sun, 4 Sep 2016 20:24:19 -0700
5d6a5ae
Subject: [PATCH] =?UTF-8?q?[perl=20#129196]=20Crash/bad=20read=20with=20?=
5d6a5ae
 =?UTF-8?q?=E2=80=98evalbytes=20S=E2=80=99?=
5d6a5ae
MIME-Version: 1.0
5d6a5ae
Content-Type: text/plain; charset=UTF-8
5d6a5ae
Content-Transfer-Encoding: 8bit
5d6a5ae
5d6a5ae
5dc13276 added some code to toke.c that did not take into account
5d6a5ae
that the opnum (‘f’) argument to UNI* could be a negated op number.
5d6a5ae
PL_last_lop_op must never be negative, since it is used as an offset
5d6a5ae
into a struct.
5d6a5ae
5d6a5ae
Tests for the crash will come in the next commit.
5d6a5ae
5d6a5ae
Signed-off-by: Petr Písař <ppisar@redhat.com>
5d6a5ae
---
5d6a5ae
 toke.c | 2 +-
5d6a5ae
 1 file changed, 1 insertion(+), 1 deletion(-)
5d6a5ae
5d6a5ae
diff --git a/toke.c b/toke.c
5d6a5ae
index 2fe8b69..2350703 100644
5d6a5ae
--- a/toke.c
5d6a5ae
+++ b/toke.c
5d6a5ae
@@ -241,7 +241,7 @@ static const char* const lex_state_names[] = {
5d6a5ae
 	if (have_x) PL_expect = x; \
5d6a5ae
 	PL_bufptr = s; \
5d6a5ae
 	PL_last_uni = PL_oldbufptr; \
5d6a5ae
-	PL_last_lop_op = f; \
5d6a5ae
+	PL_last_lop_op = f < 0 ? -f : f; \
5d6a5ae
 	if (*s == '(') \
5d6a5ae
 	    return REPORT( (int)FUNC1 ); \
5d6a5ae
 	s = skipspace(s); \
5d6a5ae
-- 
5d6a5ae
2.7.4
5d6a5ae