Skip to content

Commit e28e506

Browse files
committed
Fix signed/unsigned comparisons
1 parent ad65f4d commit e28e506

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

Modules/_ssl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5883,7 +5883,8 @@ _ssl_MemoryBIO_read_impl(PySSLMemoryBIO *self, int len)
58835883
{
58845884
int avail, nbytes;
58855885

5886-
avail = (int)Py_MIN(BIO_ctrl_pending(self->bio), INT_MAX);
5886+
size_t pending = BIO_ctrl_pending(self->bio);
5887+
avail = (int)Py_MIN(pending, (size_t)INT_MAX);
58875888
if ((len < 0) || (len > avail))
58885889
len = avail;
58895890

Modules/cjkcodecs/cjkcodecs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ get_module_state(PyObject *mod)
163163
do { \
164164
Py_UCS4 _c1 = (c1); \
165165
Py_UCS4 _c2 = (c2); \
166-
if (_PyUnicodeWriter_Prepare(writer, 2, Py_MAX(_c1, c2)) < 0) \
166+
if (_PyUnicodeWriter_Prepare(writer, 2, Py_MAX(_c1, _c2)) < 0) \
167167
return MBERR_EXCEPTION; \
168168
PyUnicode_WRITE(writer->kind, writer->data, writer->pos, _c1); \
169169
PyUnicode_WRITE(writer->kind, writer->data, writer->pos + 1, _c2); \

Objects/obmalloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3255,10 +3255,10 @@ _PyMem_DebugRawRealloc(void *ctx, void *p, size_t nbytes)
32553255
}
32563256
else {
32573257
size_t i = original_nbytes - ERASED_SIZE;
3258-
memcpy(data, save, Py_MIN(nbytes, ERASED_SIZE));
3258+
memcpy(data, save, Py_MIN(nbytes, (size_t)ERASED_SIZE));
32593259
if (nbytes > i) {
32603260
memcpy(data + i, &save[ERASED_SIZE],
3261-
Py_MIN(nbytes - i, ERASED_SIZE));
3261+
Py_MIN(nbytes - i, (size_t)ERASED_SIZE));
32623262
}
32633263
}
32643264
#endif

0 commit comments

Comments
 (0)