Skip to content

bpo-35091: Objects/listobject.c: Don't rely on signed int overflow in…#10175

Closed
izbyshev wants to merge 1 commit intopython:masterfrom
izbyshev:bpo-35091
Closed

bpo-35091: Objects/listobject.c: Don't rely on signed int overflow in…#10175
izbyshev wants to merge 1 commit intopython:masterfrom
izbyshev:bpo-35091

Conversation

@izbyshev
Copy link
Copy Markdown
Contributor

@izbyshev izbyshev commented Oct 28, 2018

… gallop functions

Signed integer overflow is undefined behavior.

https://bugs.python.org/issue35091

… gallop functions

Signed integer overflow is undefined behavior.
@serhiy-storchaka
Copy link
Copy Markdown
Member

Other option is using unsigned integers. In this case additional checks could be removed. The check in the while condition would be enough.

@izbyshev
Copy link
Copy Markdown
Contributor Author

@serhiy-storchaka If it's OK to change types of several variables in affected functions (because if only ofs is changed, we'd need to add casts all over the place to avoid signed/unsigned comparison warnings), I'll update the patch.

@serhiy-storchaka
Copy link
Copy Markdown
Member

Added @tim-one, the author of this code.

@izbyshev
Copy link
Copy Markdown
Contributor Author

@serhiy-storchaka, @tim-one I've implemented an alternative PR #10184 that uses size_t in gallop functions instead.

@csabella
Copy link
Copy Markdown
Contributor

Merged GH-10202 as the PR approved by @tim-one, so I'll close this one.

@csabella csabella closed this May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants