Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-29505: Fix interpreter in fuzzing targets to be relocatable #13907

Merged
merged 1 commit into from
Jun 8, 2019

Conversation

ammaraskar
Copy link
Member

@ammaraskar ammaraskar commented Jun 8, 2019

Trying to get python fully checked into oss-fuzz, see google/oss-fuzz#2493 and the abandoned google/oss-fuzz#731

One of the concerns in the old pull request was that the python build will be moved from the --prefix it is installed in to another directory. This was causing the fuzz targets (which are essentially just programs with embedded python interpreters) to throw:

Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

As it turns out the fuzz targets were missing a call to Py_SetProgramName which is what _testembed.c does. I am not an expert in the import machinery at all but I'm assuming the Py_SetProgramName call is essential to setting up the right prefixes internally as the docs somewhat suggest:

This is derived through a number of complicated rules from the program name set with
Py_SetProgramName() and some environment variables; "

If so, the docs can probably be improved in this regard.


Potential reviewers: @gpshead @alex (skip-news label can be applied)

https://bugs.python.org/issue29505

@mangrisano
Copy link
Contributor

Hi. Thank you for the pull request. I left a comment about the change.

Copy link
Member

@gpshead gpshead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

@miss-islington
Copy link
Contributor

Thanks @ammaraskar for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-13914 is a backport of this pull request to the 3.8 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label Jun 8, 2019
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 8, 2019
…onGH-13907)

(cherry picked from commit a15a7bc)

Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
@bedevere-bot
Copy link

GH-13915 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request Jun 8, 2019
…3907)

(cherry picked from commit a15a7bc)

Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
miss-islington added a commit that referenced this pull request Jun 8, 2019
…3907)

(cherry picked from commit a15a7bc)

Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants