Skip to content

[3.8] bpo-37926: Fix PySys_SetArgvEx(0, NULL, 0) crash (GH-15415)#15420

Merged
vstinner merged 1 commit into
python:3.8from
vstinner:sys_setargex38
Aug 23, 2019
Merged

[3.8] bpo-37926: Fix PySys_SetArgvEx(0, NULL, 0) crash (GH-15415)#15420
vstinner merged 1 commit into
python:3.8from
vstinner:sys_setargex38

Conversation

@vstinner

@vstinner vstinner commented Aug 23, 2019

Copy link
Copy Markdown
Member

empty_argv is no longer static in Python 3.8, but it is declared in
a temporary scope, whereas argv keeps a reference to it.
empty_argv memory (allocated on the stack) is reused by
make_sys_argv() code which is inlined when using gcc -O3.

Define empty_argv in PySys_SetArgvEx() body, to ensure
that it remains valid for the whole lifetime of
the PySys_SetArgvEx() call.

(cherry picked from commit c486825)

https://bugs.python.org/issue37926

empty_argv is no longer static in Python 3.8, but it is declared in
a temporary scope, whereas argv keeps a reference to it.
empty_argv memory (allocated on the stack) is reused by
make_sys_argv() code which is inlined when using gcc -O3.

Define empty_argv in PySys_SetArgvEx() body, to ensure
that it remains valid for the whole lifetime of
the PySys_SetArgvEx() call.

(cherry picked from commit c486825)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants