Description
Bug report
We did a fuzzing test on Python3.9.15, a recursion error happened.
from pyclbr import *
import pyclbr
import io
import tokenize
from token import DEDENT
from token import NAME
from token import OP
class demoCls():
def __init__(self):
pass
def demoFunc(self, arg1,arg2):
try:
ret = pyclbr.readmodule_ex(arg1,arg2)
except (AttributeError, ImportError, ModuleNotFoundError, OSError, StopIteration, TypeError, ValueError, tokenize.StopTokenizing, tokenize.TokenError):
pass
module = '.'* 100_100
path = None
dc = demoCls()
dc.demoFunc(module, path)Bug info
Traceback (most recent call last):
File "/root/fuzzVuls/Python3.9.15/pyclbr.readmodule_ex/1#pyclbr#readmodule_ex.py", line 24, in <module>
dc.demoFunc(module, path)
File "/root/fuzzVuls/Python3.9.15/pyclbr.readmodule_ex/1#pyclbr#readmodule_ex.py", line 16, in demoFunc
ret = pyclbr.readmodule_ex(arg1,arg2)
File "/root/anaconda3/lib/python3.9/pyclbr.py", line 116, in readmodule_ex
return _readmodule(module, path or [])
File "/root/anaconda3/lib/python3.9/pyclbr.py", line 149, in _readmodule
parent = _readmodule(package, path, inpackage)
File "/root/anaconda3/lib/python3.9/pyclbr.py", line 149, in _readmodule
parent = _readmodule(package, path, inpackage)
File "/root/anaconda3/lib/python3.9/pyclbr.py", line 149, in _readmodule
parent = _readmodule(package, path, inpackage)
[Previous line repeated 993 more times]
File "/root/anaconda3/lib/python3.9/pyclbr.py", line 140, in _readmodule
if module in sys.builtin_module_names and inpackage is None:
RecursionError: maximum recursion depth exceeded in comparisonMy environment
CPython: 3.9.15
Ubuntu: 18.0.4 (x86 64)

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
