Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Uninitialized memory read related to type_comment for *args or **kwds #36

Closed
gvanrossum opened this issue Mar 31, 2017 · 1 comment
Closed
Assignees

Comments

@gvanrossum
Copy link
Member

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.

@gvanrossum
Copy link
Member Author

gvanrossum commented Apr 8, 2017

I had an internal diff that was consistently failing with this problem and it is passing with #38 applied, so I am confident that we've nailed the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants