-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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-37013: Fix the error handling in socket.if_indextoname() #13503
bpo-37013: Fix the error handling in socket.if_indextoname() #13503
Conversation
I don't think this needs a unit test, mainly because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution.
@matrixise I thought we gave you merge permissions? Want to hit the button? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if_indextoname()
takes unsigned int
. Therefore highest bits of index
can be ignored.
If UINT_MAX < index <= ULONG_MAX -- ignore highest bits.
If ULONG_MAX < index -- OverflowError.
I suggest to handle large index uniformly.
if ((unsigned long)(unsigned int)index != index) {
PyErr_SetString(OverflowError, "...");
}
This PR seems to have stalled. @serhiy-storchaka, are you waiting for @ZackerySpytz to address your comments? |
Yes, I am waiting for addressing my comments. And please add tests for |
@zoobar yep, with great powers, great responsibilities, but I don't want to crash Python ;-) @ZackerySpytz could you update your PR with the comments of @serhiy-storchaka ? Thank you |
@ZackerySpytz, please address the code review comments. Thanks! |
@serhiy-storchaka, please re-review as I believe your comments have been addressed. Thank you! |
Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10, 3.11, 3.12. |
…H-13503) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms. (cherry picked from commit 0daf555) Co-authored-by: Zackery Spytz <[email protected]>
GH-112597 is a backport of this pull request to the 3.12 branch. |
GH-112598 is a backport of this pull request to the 3.11 branch. |
…H-13503) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms. (cherry picked from commit 0daf555) Co-authored-by: Zackery Spytz <[email protected]>
GH-112599 is a backport of this pull request to the 3.10 branch. |
GH-112600 is a backport of this pull request to the 3.9 branch. |
…H-13503) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms. (cherry picked from commit 0daf555) Co-authored-by: Zackery Spytz <[email protected]>
…H-13503) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms. (cherry picked from commit 0daf555) Co-authored-by: Zackery Spytz <[email protected]>
…H-13503) (GH-112597) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms. (cherry picked from commit 0daf555) Co-authored-by: Zackery Spytz <[email protected]>
…H-13503) (GH-112598) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms. (cherry picked from commit 0daf555) Co-authored-by: Zackery Spytz <[email protected]>
Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8. |
…H-13503) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms. (cherry picked from commit 0daf555) Co-authored-by: Zackery Spytz <[email protected]>
GH-113474 is a backport of this pull request to the 3.8 branch. |
…H-13503) (GH-113474) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms. (cherry picked from commit 0daf555) Co-authored-by: Zackery Spytz <[email protected]>
…H-13503) (GH-112600) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms. (cherry picked from commit 0daf555) Co-authored-by: Zackery Spytz <[email protected]>
…H-13503) (GH-112599) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms. (cherry picked from commit 0daf555) Co-authored-by: Zackery Spytz <[email protected]>
…H-13503) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms.
…H-13503) * Fix a crash when pass UINT_MAX. * Fix an integer overflow on 64-bit non-Windows platforms.
https://bugs.python.org/issue37013