Skip to content

Commit 7b4e630

Browse files
committed
S_intuit_more: Call scan_ident in check-only mode
This fixes the bug that examining the parse buffer had side-effects. I don't know what the implications of that were.
1 parent a454654 commit 7b4e630

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

toke.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4743,12 +4743,13 @@ S_intuit_more(pTHX_ char *s, char *e,
47434743
* changed since the code was first added */
47444744
char tmpbuf[ C_ARRAY_LENGTH(PL_tokenbuf) * 4 ];
47454745

4746-
/* khw: scan_ident shouldn't be used as-is. It has side
4747-
* effects and can end up calling this function recursively.
4748-
*
4749-
* khw: If what follows can't be an identifier, say it is too
4750-
* long or is $001, then it must be a charclass */
4751-
scan_ident(s, tmpbuf, C_ARRAY_END(tmpbuf), 0);
4746+
if (! scan_ident(s, tmpbuf, C_ARRAY_END(tmpbuf), CHECK_ONLY))
4747+
{
4748+
/* An illegal identifier means this can't be a subscript;
4749+
* it's an error or it could be a charclass */
4750+
return false;
4751+
}
4752+
47524753
len = strlen(tmpbuf);
47534754

47544755
/* khw: This only looks at global variables; lexicals came

0 commit comments

Comments
 (0)