bpo-37013: Fix the error handling in socket.if_indextoname()#13503
Conversation
|
I don't think this needs a unit test, mainly because |
matrixise
left a comment
There was a problem hiding this comment.
Thank you for your contribution.
|
@matrixise I thought we gave you merge permissions? Want to hit the button? :) |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
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