Skip to content

Commit

Permalink
pythongh-95876: Fix format string in pegen error location code (pytho…
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran authored Aug 11, 2022
1 parent 5ed584c commit b4c857d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Fix format string in ``_PyPegen_raise_error_known_location`` that can lead
to memory corruption on some 64bit systems. The function was building a
tuple with ``i`` (int) instead of ``n`` (Py_ssize_t) for Py_ssize_t
arguments.
2 changes: 1 addition & 1 deletion Parser/pegen_errors.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ _PyPegen_raise_error_known_location(Parser *p, PyObject *errtype,
}
}
}
tmp = Py_BuildValue("(OiiNii)", p->tok->filename, lineno, col_number, error_line, end_lineno, end_col_number);
tmp = Py_BuildValue("(OnnNnn)", p->tok->filename, lineno, col_number, error_line, end_lineno, end_col_number);
if (!tmp) {
goto error;
}
Expand Down

0 comments on commit b4c857d

Please sign in to comment.