10000 gh-96819: check if the length of a pipe write is not greater than 512 by saito828koki · Pull Request #96890 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-96819: check if the length of a pipe write is not greater than 512 #96890

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

Merged
merged 8 commits into from
Oct 3, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: check the length of msg, not the length of name
  • Loading branch information
saito828koki committed Sep 17, 2022
commit 2efc372895bca0c6e6c8cc9ad6802efe2ffed77c
2 changes: 1 addition & 1 deletion Lib/multiprocessing/resource_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def unregister(self, name, rtype):
def _send(self, cmd, name, rtype):
self.ensure_running()
msg = '{0}:{1}:{2}\n'.format(cmd, name, rtype).encode('ascii')
if len(name) > 512:
if len(msg) > 512:
# posix guarantees that writes to a pipe of less than PIPE_BUF
# bytes are atomic, and that PIPE_BUF >= 512
raise ValueError('name too long')
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this also be updated? ie. msg too long?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DanielNoord
Thanks for your comment!
The error message should also be updated. I will fix it.

Expand Down
0