Skip to content

fix: Buffer overflow in bytes_to_read#1053

Open
BradleyKirton wants to merge 1 commit intopyinvoke:mainfrom
BradleyKirton:main
Open

fix: Buffer overflow in bytes_to_read#1053
BradleyKirton wants to merge 1 commit intopyinvoke:mainfrom
BradleyKirton:main

Conversation

@BradleyKirton
Copy link
Copy Markdown

Hi there 👋

I encountered a runtime exception in invoke/terminals.py::bytes_to_read on Python 3.14.

I believe the issue is because the original version passed the incorrect sized arg to fcntl.ioctl.

gh-132915: [fcntl.fcntl()](https://docs.python.org/3/library/
fcntl.html#fcntl.fcntl) and fcntl.ioctl() can now detect a buffer overflow and raise SystemError. The stack and memory can be corrupted in such case, so treat this error as fatal.

See python/cpython#132915

I have created this PR which provides correctly sized arg.

@BradleyKirton BradleyKirton force-pushed the main branch 2 times, most recently from e1e5d11 to 9c51496 Compare November 25, 2025 10:48
Fix buffer overflow error in invoke/terminals.py::bytes_to_read by providing
correctly sized int.
@M1troll
Copy link
Copy Markdown

M1troll commented Dec 15, 2025

Hey!
I encountered the same issue =(
image

@stanislaw
Copy link
Copy Markdown

👍

It would be great to have this integrated. My tasks break occasionally with Python 3.14 😢

Copy link
Copy Markdown

@matthiask matthiask left a comment

Choose a reason for hiding this comment

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

I can run any fabric task which doesn't accept input and type into the terminal while the task is running and it crashes with the mentioned buffer overflow.

Applying this patch fixes it locally for me.

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.

4 participants