Uninitialized memory read related to type_comment for *args or **kwds #36
Description
I believe I've found a very shy error due to an uninitialized memory read in typed_ast.
The repro conditions are murky, it only works on a particular rev of a particular codebase. The problem manifests itself in one of two ways:
-
SystemError: <built-in function _parse> returned a result with an error set
with a traceback ending at line 54 in ast3.py; I suspect it is getting the type_comment from a struct that doesn't have that field and reading nonsense. (Most of the time the memory was freshly allocated and the nonsense happens to look like a NULL pointer which then gets treated as intended, but apparently in some scenarios it returns non-NULL garbage.) -
Function has duplicate type signatures
from make_argument() in transform_args() in mypy/fastparse.py; this for a line that is actually correct; so far all examples I've seen involve*args
and I suspect the true cause is a similar scenario as the first bullet, a non-NULL piece of garbage.
ISTR we fixed a similar issue in the past.
I will investigate more next week.