mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-141370: Fix undefined behavior when using Py_ABS() (GH-141548)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
This commit is contained in:
parent
1d8f3ed2eb
commit
706fdda8b3
6 changed files with 43 additions and 3 deletions
|
|
@ -42,8 +42,7 @@ static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen,
|
|||
else {
|
||||
bytes_per_sep_group = 0;
|
||||
}
|
||||
|
||||
unsigned int abs_bytes_per_sep = Py_ABS(bytes_per_sep_group);
|
||||
unsigned int abs_bytes_per_sep = _Py_ABS_CAST(unsigned int, bytes_per_sep_group);
|
||||
Py_ssize_t resultlen = 0;
|
||||
if (bytes_per_sep_group && arglen > 0) {
|
||||
/* How many sep characters we'll be inserting. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue