Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-95380: Removing the 1024 bytes limit in the fcntl_ioctl_impl functions.#95526

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
zenbooster wants to merge11 commits intopython:mainfromzenbooster:main

Conversation

zenbooster
Copy link

@zenboosterzenbooster commentedAug 1, 2022
edited by bedevere-bot
Loading

Goblenus and sush1q reacted with thumbs up emoji
zenboosterand others added9 commitsJuly 29, 2022 15:59
Пулл-реквестpythongh-95429 внёс по сути те же изменения, так что фокусируемсяна отсутствующем там fcntl_ioctl_impl.
Консольная команда, использованная для обновления:    python Tools/clinic/clinic.py Modules/fcntlmodule.cЕсли этого не сделать, автоматическая проверка пулл-реквеста увидитрассинхронизацию, и у пул-реквеста в статусах будет крестик напротив"Tests / Check if generated files are up to date".
Remove `fcntl_fcntl_impl` keeping `fcntl_ioctl_impl`
@ghost
Copy link

ghost commentedAug 1, 2022
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

if (mutate_arg && (len <= IOCTL_BUFSZ)) {
char *buf = PyBytes_AS_STRING(o);

memcpy(buf, str, len);

Choose a reason for hiding this comment

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

You can simply pass it toPyBytes_FromStringAndSize().

Choose a reason for hiding this comment

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

On other hand, using NULL is necessary to prevent caching of newly created bytes object.

memcpy(str, buf, len);
}
PyBuffer_Release(&pstr); /* No further access to str below this point */
if (ret < 0) {
Py_DECREF(o);

Choose a reason for hiding this comment

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

PyBuffer_Release() andPy_DECREF() can modifyerrno. You should save its value afterioctl() call and restore it just beforePyErr_SetFromErrno().

@python-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

CLA signed

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

Since this PR was not active for a long time, I created an alternative PR#132907, which keeps using a 1024 bytes buffer for small arguments. This is safer in case of buffer overflow.

if (mutate_arg && (len <= IOCTL_BUFSZ)) {
char *buf = PyBytes_AS_STRING(o);

memcpy(buf, str, len);

Choose a reason for hiding this comment

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

On other hand, using NULL is necessary to prevent caching of newly created bytes object.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka left review comments

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@zenbooster@serhiy-storchaka@bedevere-bot@arhadthedev@kumaraditya303

[8]ページ先頭

©2009-2025 Movatter.jp