summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2019-07-31 11:06:20 +1000
committerTony Cook <tony@develop-help.com>2019-07-31 11:06:20 +1000
commit8348ac19a3c37caf807ef0f64320e0bec53b6747 (patch)
tree5ec5bef633fc816a7a7e0358051eabdd0d4f79fd /toke.c
parent82007f754ed1e129a53fc7c964d84cddba7ca0de (diff)
downloadperl-8348ac19a3c37caf807ef0f64320e0bec53b6747.tar.gz
(perl #134310) don't confuse S_no_op()
This code could previously set PL_bufptr so it points after the returned s pointer, which S_no_op() asserts on for the test case. Since setting PL_bufptr here is useful when producing the error message, just make sure we restore it.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/toke.c b/toke.c
index 2f794d69b9..26de580a24 100644
--- a/toke.c
+++ b/toke.c
@@ -11342,10 +11342,12 @@ Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
behaviour, like for: "0x.3" and "0x+$foo".
*/
const char *d = s;
+ char *oldbp = PL_bufptr;
if (*d) ++d; /* so the user sees the bad non-digit */
PL_bufptr = (char *)d; /* so yyerror reports the context */
yyerror(Perl_form(aTHX_ "No digits found for %s literal",
shift == 4 ? "hexadecimal" : "binary"));
+ PL_bufptr = oldbp;
}
if (overflowed) {