summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-03-08 11:25:39 (GMT)
committerGitHub <noreply@github.com>2024-03-08 11:25:39 (GMT)
commit3abf26778782879ef50561e851dbc751d9888806 (patch)
treeef917f911541fe5c13d7637627ce58366e5334df /Python
parent0f6cd295d7911b558d3d519330eafcc6338bc9d4 (diff)
downloadcpython-3abf26778782879ef50561e851dbc751d9888806.zip
cpython-3abf26778782879ef50561e851dbc751d9888806.tar.gz
cpython-3abf26778782879ef50561e851dbc751d9888806.tar.bz2
[3.11] gh-116447: Fix possible UB in `arraymodule` and `getargs` (GH-116459) (#116497)
gh-116447: Fix possible UB in `arraymodule` and `getargs` (GH-116459) (cherry picked from commit fdb2d90a274158aee23b526d972172bf41bd4b7e) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Python')
-rw-r--r--Python/getargs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index e18d771..b6651ae 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -672,7 +672,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
switch (c) {
case 'b': { /* unsigned byte -- very short int */
- char *p = va_arg(*p_va, char *);
+ unsigned char *p = va_arg(*p_va, unsigned char *);
long ival = PyLong_AsLong(arg);
if (ival == -1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;
@@ -693,7 +693,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'B': {/* byte sized bitfield - both signed and unsigned
values allowed */
- char *p = va_arg(*p_va, char *);
+ unsigned char *p = va_arg(*p_va, unsigned char *);
unsigned long ival = PyLong_AsUnsignedLongMask(arg);
if (ival == (unsigned long)-1 && PyErr_Occurred())
RETURN_ERR_OCCURRED;