summaryrefslogtreecommitdiffstats
path: root/Modules/clinic
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-20 06:31:51 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-20 06:31:51 (GMT)
commite3037e114509913874a28746f5e05780919e909a (patch)
treedead0e6507d6c83d63d90750380b17c7fb566f5d /Modules/clinic
parentc74bb9d35060717eb8b658b89500ee18855c1080 (diff)
parent2ef7c478444f453a04ae63ecc3d3de07915ad2b0 (diff)
downloadcpython-e3037e114509913874a28746f5e05780919e909a.zip
cpython-e3037e114509913874a28746f5e05780919e909a.tar.gz
cpython-e3037e114509913874a28746f5e05780919e909a.tar.bz2
Issue #23728: binascii.crc_hqx() could return an integer outside of the range
0-0xffff for empty data.
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/binascii.c.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h
index d7c2ee6..25d39d2 100644
--- a/Modules/clinic/binascii.c.h
+++ b/Modules/clinic/binascii.c.h
@@ -267,25 +267,25 @@ PyDoc_STRVAR(binascii_crc_hqx__doc__,
#define BINASCII_CRC_HQX_METHODDEF \
{"crc_hqx", (PyCFunction)binascii_crc_hqx, METH_VARARGS, binascii_crc_hqx__doc__},
-static int
-binascii_crc_hqx_impl(PyModuleDef *module, Py_buffer *data, int crc);
+static unsigned int
+binascii_crc_hqx_impl(PyModuleDef *module, Py_buffer *data, unsigned int crc);
static PyObject *
binascii_crc_hqx(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer data = {NULL, NULL};
- int crc;
- int _return_value;
+ unsigned int crc;
+ unsigned int _return_value;
if (!PyArg_ParseTuple(args,
- "y*i:crc_hqx",
+ "y*I:crc_hqx",
&data, &crc))
goto exit;
_return_value = binascii_crc_hqx_impl(module, &data, crc);
- if ((_return_value == -1) && PyErr_Occurred())
+ if ((_return_value == (unsigned int)-1) && PyErr_Occurred())
goto exit;
- return_value = PyLong_FromLong((long)_return_value);
+ return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
exit:
/* Cleanup for data */
@@ -544,4 +544,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=175025a8a94fbdd1 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5f8d3578618b3432 input=a9049054013a1b77]*/