summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfimov Vasily <real@ispras.ru>2016-02-09 20:27:24 +0300
committerEfimov Vasily <real@ispras.ru>2017-10-30 19:58:51 +0300
commit5a74b95cfb2faca7470fd814f10bd9d0650c3a4a (patch)
treea5ae8bdf5402d095df91d213846f80852f18de31
parente71a4a041b87b8173f7b39b75a56fc2406736a38 (diff)
downloadply-5a74b95cfb2faca7470fd814f10bd9d0650c3a4a.tar.gz
cpp: check token list bounds during macro expansion
Signed-off-by: Efimov Vasily <real@ispras.ru>
-rw-r--r--ply/cpp.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ply/cpp.py b/ply/cpp.py
index d00348e..f527655 100644
--- a/ply/cpp.py
+++ b/ply/cpp.py
@@ -510,7 +510,7 @@ class Preprocessor(object):
j = i + 1
while j < len(tokens) and tokens[j].type in self.t_WS:
j += 1
- if tokens[j].value == '(':
+ if j < len(tokens) and tokens[j].value == '(':
tokcount,args,positions = self.collect_args(tokens[j:])
if not m.variadic and len(args) != len(m.arglist):
self.error(self.source,t.lineno,"Macro %s requires %d arguments" % (t.value,len(m.arglist)))