diff -r e831a98b3f43 Modules/_pickle.c --- a/Modules/_pickle.c Sat Aug 16 01:03:39 2014 +0200 +++ b/Modules/_pickle.c Sat Aug 16 01:09:46 2014 +0200 @@ -425,10 +425,10 @@ Pdata_grow(Pdata *self) new_allocated = (allocated >> 3) + 6; /* check for integer overflow */ - if (new_allocated > PY_SSIZE_T_MAX - allocated) + if ((size_t)new_allocated > (size_t)PY_SSIZE_T_MAX - (size_t)allocated) goto nomemory; new_allocated += allocated; - if (new_allocated > (PY_SSIZE_T_MAX / sizeof(PyObject *))) + if ((size_t)new_allocated > ((size_t)PY_SSIZE_T_MAX / sizeof(PyObject *))) goto nomemory; data = PyMem_REALLOC(data, new_allocated * sizeof(PyObject *)); if (data == NULL) @@ -850,7 +850,7 @@ static int static void _write_size64(char *out, size_t value) { - int i; + size_t i; assert(sizeof(size_t) <= 8); @@ -2118,12 +2118,13 @@ write_utf8(PicklerObject *self, char *da char header[9]; Py_ssize_t len; + assert(size >= 0); if (size <= 0xff && self->proto >= 4) { header[0] = SHORT_BINUNICODE; header[1] = (unsigned char)(size & 0xff); len = 2; } - else if (size <= 0xffffffffUL) { + else if ((size_t)size <= 0xffffffffUL) { header[0] = BINUNICODE; header[1] = (unsigned char)(size & 0xff); header[2] = (unsigned char)((size >> 8) & 0xff); @@ -4508,7 +4509,7 @@ calc_binsize(char *bytes, int nbytes) int i; size_t x = 0; - for (i = 0; i < nbytes && i < sizeof(size_t); i++) { + for (i = 0; i < nbytes && (size_t)i < sizeof(size_t); i++) { x |= (size_t) s[i] << (8 * i); } diff -r e831a98b3f43 Modules/_sqlite/cursor.c --- a/Modules/_sqlite/cursor.c Sat Aug 16 01:03:39 2014 +0200 +++ b/Modules/_sqlite/cursor.c Sat Aug 16 01:09:46 2014 +0200 @@ -46,7 +46,7 @@ static pysqlite_StatementKind detect_sta dst = buf; *dst = 0; - while (Py_ISALPHA(*src) && dst - buf < sizeof(buf) - 2) { + while (Py_ISALPHA(*src) && (dst - buf) < (Py_intptr_t)sizeof(buf) - 2) { *dst++ = Py_TOLOWER(*src++); } diff -r e831a98b3f43 Modules/socketmodule.c --- a/Modules/socketmodule.c Sat Aug 16 01:03:39 2014 +0200 +++ b/Modules/socketmodule.c Sat Aug 16 01:09:46 2014 +0200 @@ -1277,7 +1277,7 @@ idna_converter(PyObject *obj, struct may return 0; } return Py_CLEANUP_SUPPORTED; -} +} /* Parse a socket address argument according to the socket object's address family. Return 1 if the address was in the proper format, @@ -1313,7 +1313,7 @@ getsockaddrarg(PySocketSockObject *s, Py #ifdef linux if (len > 0 && path[0] == 0) { /* Linux abstract namespace extension */ - if (len > sizeof addr->sun_path) { + if ((size_t)len > sizeof addr->sun_path) { PyErr_SetString(PyExc_OSError, "AF_UNIX path too long"); goto unix_out; @@ -1323,7 +1323,7 @@ getsockaddrarg(PySocketSockObject *s, Py #endif /* linux */ { /* regular NULL-terminated string */ - if (len >= sizeof addr->sun_path) { + if ((size_t)len >= sizeof addr->sun_path) { PyErr_SetString(PyExc_OSError, "AF_UNIX path too long"); goto unix_out; @@ -1675,7 +1675,7 @@ getsockaddrarg(PySocketSockObject *s, Py if (len == 0) { ifr.ifr_ifindex = 0; - } else if (len < sizeof(ifr.ifr_name)) { + } else if ((size_t)len < sizeof(ifr.ifr_name)) { strncpy(ifr.ifr_name, PyBytes_AS_STRING(interfaceName), sizeof(ifr.ifr_name)); ifr.ifr_name[(sizeof(ifr.ifr_name))-1] = '\0'; if (ioctl(s->sock_fd, SIOCGIFINDEX, &ifr) < 0) { @@ -4290,7 +4290,7 @@ Return the IP address (a string of the f /* Convenience function common to gethostbyname_ex and gethostbyaddr */ static PyObject * -gethost_common(struct hostent *h, struct sockaddr *addr, int alen, int af) +gethost_common(struct hostent *h, struct sockaddr *addr, size_t alen, int af) { char **pch; PyObject *rtn_tuple = (PyObject *)NULL;