[issue30710] getaddrinfo raises OverflowError

2017-06-20 Thread Radek Smejkal
New submission from Radek Smejkal: If the port argument is a number, getaddrinfo attempts to convert it to a C long, that raises OverflowError if the conversion fails. Instead, getaddrinfo should convert the port to a string (bytes) directly and rely on the underlying getaddrinfo to return

[issue30711] getaddrinfo invalid port number

2017-06-20 Thread Radek Smejkal
New submission from Radek Smejkal: Some getaddrinfo implementations do not detect invalid numeric services and blindly pass the port number to htons(). For example, service "960179" is returned as port 42675. glibc https://sourceware.org/bugzilla/show_bug.cgi?id=16208 https://sour

[issue30710] getaddrinfo raises OverflowError

2017-06-20 Thread Radek Smejkal
Radek Smejkal added the comment: Use PyObject_Str and PyUnicode_AsUTF8 if the port argument is a PyLong instead of converting it to an intermediate C long that may raise OverflowError. See getaddrinfo_overflow_error.patch -- components: +Extension Modules -Library (Lib) keywords

[issue30710] getaddrinfo raises OverflowError

2017-06-21 Thread Radek Smejkal
Radek Smejkal added the comment: > But how large is the performance hit of this change? It adds at least one > additional memory allocation for the str object. If the slowdown is > significant perhaps it is worth to keep the old code as a fast path

[issue30710] getaddrinfo raises OverflowError

2017-06-21 Thread Radek Smejkal
Radek Smejkal added the comment: > Why can't the user simply pass in a string service name in the first place? He/she can. But I don't propose to change that. The patch only changes the way a given number is converted to a string. That is, without an interme

[issue30710] getaddrinfo raises OverflowError

2017-06-21 Thread Radek Smejkal
Radek Smejkal added the comment: > I like your idea about getting rid of OverflowError. But wouldn't it make the > problem with other reported by you issue, issue30711, worse? It depends on the implementation of the underlying getaddrinfo. For Modules/getaddrinfo.c, it will b

[issue30711] getaddrinfo invalid port number

2017-06-21 Thread Radek Smejkal
Changes by Radek Smejkal : -- components: +Extension Modules -Library (Lib) keywords: +patch Added file: http://bugs.python.org/file46965/getaddrinfo_invalid_port.patch ___ Python tracker <http://bugs.python.org/issue30

[issue30711] getaddrinfo invalid port number

2017-06-23 Thread Radek Smejkal
Changes by Radek Smejkal : Removed file: http://bugs.python.org/file46965/getaddrinfo_invalid_port.patch ___ Python tracker <http://bugs.python.org/issue30711> ___ ___

[issue30711] getaddrinfo invalid port number

2017-06-23 Thread Radek Smejkal
Radek Smejkal added the comment: See also issue30710. -- ___ Python tracker <http://bugs.python.org/issue30711> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30786] getaddrinfo emulation does not support AI_NUMERICSERV

2017-06-27 Thread Radek Smejkal
New submission from Radek Smejkal: Modules/getaddrinfo.c should support AI_NUMERICSERV. Moreover, not supporting AI_NUMERICSERV may cause troubles on platforms where the getaddrinfo function is available but it's buggy (see configure.ac and Modules/socketmodule.c), because Modules/addri

[issue30711] getaddrinfo invalid port number

2017-06-27 Thread Radek Smejkal
Radek Smejkal added the comment: See also issue30786. -- ___ Python tracker <http://bugs.python.org/issue30711> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30710] getaddrinfo raises OverflowError

2017-06-27 Thread Radek Smejkal
Changes by Radek Smejkal : -- pull_requests: +2483 ___ Python tracker <http://bugs.python.org/issue30710> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30711] getaddrinfo invalid port number

2017-06-27 Thread Radek Smejkal
Changes by Radek Smejkal : -- pull_requests: +2484 ___ Python tracker <http://bugs.python.org/issue30711> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30786] getaddrinfo emulation does not support AI_NUMERICSERV

2017-06-27 Thread Radek Smejkal
Changes by Radek Smejkal : -- pull_requests: +2485 ___ Python tracker <http://bugs.python.org/issue30786> ___ ___ Python-bugs-list mailing list Unsubscribe: