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

gh-115886: Handle embedded null characters in shared memory name #115887

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Feb 24, 2024

shm_open() and shm_unlink() now check for embedded null characters in the name and raise an error instead of silently truncating it.

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
@erlend-aasland
Copy link
Contributor

erlend-aasland commented Feb 24, 2024

I first thought, "why not just use the str converter" in Argument Clinic1, but checks for embedded null characters are only generated if the param in question is a positional-only param. str(zeroes=False) does not work either, which suggests to me this is a bug in Argument Clinic.

Footnotes

  1. less churn, less code duplication

@serhiy-storchaka
Copy link
Member Author

We need the original object for error.

I am going to change this code, add support of bytes and use filesystem encoding, but only in main.

@erlend-aasland
Copy link
Contributor

We need the original object for error.

Ah, yes I see :(

@serhiy-storchaka serhiy-storchaka merged commit 79811ed into python:main Feb 25, 2024
37 checks passed
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@serhiy-storchaka serhiy-storchaka deleted the shm-name-embedded-null branch February 25, 2024 09:31
@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 79811ededd160b6e8bcfbe4b0f9d5b4589280f19 3.12

@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 79811ededd160b6e8bcfbe4b0f9d5b4589280f19 3.11

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Feb 25, 2024
…ory name (pythonGH-115887)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
(cherry picked from commit 79811ed)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Feb 25, 2024

GH-115906 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Feb 25, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Feb 25, 2024
…ory name (pythonGH-115887)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
(cherry picked from commit 79811ed)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Feb 25, 2024

GH-115907 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Feb 25, 2024
serhiy-storchaka added a commit that referenced this pull request Feb 25, 2024
…me (GH-115887) (GH-115906)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
(cherry picked from commit 79811ed)
serhiy-storchaka added a commit that referenced this pull request Feb 25, 2024
…me (GH-115887) (GH-115907)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
(cherry picked from commit 79811ed)
woodruffw pushed a commit to woodruffw-forks/cpython that referenced this pull request Mar 4, 2024
pythonGH-115887)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
pythonGH-115887)

shm_open() and shm_unlink() now check for embedded null characters in
the name and raise an error instead of silently truncating it.
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.

2 participants