diff options
author | shadchin <shadchin@yandex-team.com> | 2024-06-13 19:29:50 +0300 |
---|---|---|
committer | shadchin <shadchin@yandex-team.com> | 2024-06-13 19:51:47 +0300 |
commit | 9051e2318afc1bfbd88a103f7392e622aa8c9527 (patch) | |
tree | 5c63ea23ebd5e7b7b9864903a9312aa853193ca5 /contrib/tools/python/src/Python/getargs.c | |
parent | 224da250178b9250c7577a167d44f94f732d3627 (diff) | |
download | ydb-9051e2318afc1bfbd88a103f7392e622aa8c9527.tar.gz |
Update Python from 2.7.16 to 2.7.18
2a151e9cf2ebdfa59d250c1bbb800e908703a6f0
Diffstat (limited to 'contrib/tools/python/src/Python/getargs.c')
-rw-r--r-- | contrib/tools/python/src/Python/getargs.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/contrib/tools/python/src/Python/getargs.c b/contrib/tools/python/src/Python/getargs.c index cc1ddde977..12ee248637 100644 --- a/contrib/tools/python/src/Python/getargs.c +++ b/contrib/tools/python/src/Python/getargs.c @@ -1156,7 +1156,19 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, memcpy(*buffer, PyString_AS_STRING(s), size + 1); - STORE_SIZE(size); + + if (flags & FLAG_SIZE_T) { + *q2 = size; + } + else { + if (INT_MAX < size) { + Py_DECREF(s); + PyErr_SetString(PyExc_OverflowError, + "size does not fit in an int"); + return converterr("", arg, msgbuf, bufsize); + } + *q = (int)size; + } } else { /* Using a 0-terminated buffer: |