Skip to content

Conversation

@ZackerySpytz
Copy link
Contributor

@ZackerySpytz ZackerySpytz commented May 22, 2019

@ZackerySpytz
Copy link
Contributor Author

I don't think this needs a unit test, mainly because (unsigned long)-1 can vary across platforms.

Copy link
Member

@matrixise matrixise left a 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.

@zooba
Copy link
Member

zooba commented May 23, 2019

@matrixise I thought we gave you merge permissions? Want to hit the button? :)

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a 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, "...");
}

@ned-deily
Copy link
Member

This PR seems to have stalled. @serhiy-storchaka, are you waiting for @ZackerySpytz to address your comments?

@serhiy-storchaka
Copy link
Member

Yes, I am waiting for addressing my comments.

And please add tests for socket.if_indextoname() called with 2**32-1, 2**32, 2**64-1, 2**64. OSError and OverflowError should be ignored, but the test should not crash.

@matrixise
Copy link
Member

@matrixise I thought we gave you merge permissions? Want to hit the button? :)

@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

@csabella
Copy link
Contributor

@ZackerySpytz, please address the code review comments. Thanks!

@csabella
Copy link
Contributor

@serhiy-storchaka, please re-review as I believe your comments have been addressed. Thank you!

@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) December 1, 2023 14:44
@serhiy-storchaka serhiy-storchaka merged commit 0daf555 into python:main Dec 1, 2023
@miss-islington-app
Copy link

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.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 1, 2023
…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]>
@bedevere-app
Copy link

bedevere-app bot commented Dec 1, 2023

GH-112597 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Dec 1, 2023
@bedevere-app
Copy link

bedevere-app bot commented Dec 1, 2023

GH-112598 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 1, 2023
…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]>
@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Dec 1, 2023
@bedevere-app
Copy link

bedevere-app bot commented Dec 1, 2023

GH-112599 is a backport of this pull request to the 3.10 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.10 only security fixes label Dec 1, 2023
@bedevere-app
Copy link

bedevere-app bot commented Dec 1, 2023

GH-112600 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 1, 2023
…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]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 1, 2023
…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]>
serhiy-storchaka pushed a commit that referenced this pull request Dec 25, 2023
…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]>
serhiy-storchaka pushed a commit that referenced this pull request Dec 25, 2023
…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]>
@miss-islington-app
Copy link

Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 25, 2023
…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]>
@bedevere-app
Copy link

bedevere-app bot commented Dec 25, 2023

GH-113474 is a backport of this pull request to the 3.8 branch.

ambv pushed a commit that referenced this pull request Jan 17, 2024
…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]>
ambv pushed a commit that referenced this pull request Jan 17, 2024
…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]>
ambv pushed a commit that referenced this pull request Jan 17, 2024
…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]>
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…H-13503)

* Fix a crash when pass UINT_MAX.
* Fix an integer overflow on 64-bit non-Windows platforms.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…H-13503)

* Fix a crash when pass UINT_MAX.
* Fix an integer overflow on 64-bit non-Windows platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-crash A hard crash of the interpreter, possibly with a core dump

Projects

None yet

Development

Successfully merging this pull request may close these issues.