-
-
Notifications
You must be signed in to change notification settings - Fork 54
[2.7, 3.6] Fix invalid read memory errors #38
Conversation
This seems a reasonable hypothesis. You can merge it if either you have proof that this fixes it or you need this to be merged before you can construct said proof. |
(And please say which it is when you do merge it. :-) |
Even if this doesn't fix #36, these are definitely invalid memory access errors and should be fixed. Most of them are harmless, but it looks like there are two that could be causing the errors we've been seeing. So far, I've been unable to repro the problems locally, so I can't be confident that this fixes them. |
|
||
if (TYPE(CHILD(n, i)) == TYPE_COMMENT) { | ||
if (i < NCH(n) && TYPE(CHILD(n, i)) == TYPE_COMMENT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gvanrossum: It seems very likely to me that this error is the cause of the Function has duplicate type signatures
you saw in #36. A spurious type comment here (which could happen from the uninitialized read) would produce the correct error, and this only happens with a *arg
, which lines up with what you saw.
@@ -1530,7 +1530,7 @@ ast_for_arguments(struct compiling *c, const node *n) | |||
int res = 0; | |||
i += 2; /* now follows keyword only arguments */ | |||
|
|||
if (TYPE(CHILD(n, i)) == TYPE_COMMENT) { | |||
if (i < NCH(n) && TYPE(CHILD(n, i)) == TYPE_COMMENT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gvanrossum: This could plausibly be the cause of SystemError: <built-in function _parse> returned a result with an error set
with crazy line numbers. The line number here is clearly based on uninitialized memory in the spurious case.
OK merge it!
…On Apr 7, 2017 12:35 PM, "David Fisher" ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In ast3/Python/ast.c
<#38 (comment)>:
> @@ -1530,7 +1530,7 @@ ast_for_arguments(struct compiling *c, const node *n)
int res = 0;
i += 2; /* now follows keyword only arguments */
- if (TYPE(CHILD(n, i)) == TYPE_COMMENT) {
+ if (i < NCH(n) && TYPE(CHILD(n, i)) == TYPE_COMMENT) {
@gvanrossum <https://github.com/gvanrossum>: This could plausibly be the
cause of SystemError: <built-in function _parse> returned a result with
an error set with crazy line numbers. The line number here is clearly
based on uninitialized memory in the spurious case.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#38 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACwrMjeVX58LT7kdLQxio170lH28vrK-ks5rto_7gaJpZM4M2VVi>
.
|
I had an internal diff that was consistently failing with this problem and it is passing with this PR applied, so I am confident that we've nailed the issue. |
This includes the important uninitialized read fix (python/typed_ast#38). For cross-reference, see also #3127 (which is now closed).
Issue python#16: accept arbitrary buffer-compatible objects
Potential fix for #36.