[Python-checkins] bpo-32587: Fixes unsafe downcast in PC/winreg.c (GH-15766)

Miss Islington (bot) webhook-mailer at python.org
Mon Sep 9 10:25:24 EDT 2019


https://github.com/python/cpython/commit/55a6f73b49625ebff575521c3a0b919880f5f0ec
commit: 55a6f73b49625ebff575521c3a0b919880f5f0ec
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-09-09T07:25:20-07:00
summary:

bpo-32587: Fixes unsafe downcast in PC/winreg.c (GH-15766)

(cherry picked from commit ef66f31ce21cd759cc0c618c5c42ba6da0a06834)

Co-authored-by: Steve Dower <steve.dower at python.org>

files:
M PC/winreg.c

diff --git a/PC/winreg.c b/PC/winreg.c
index 0016b320cac0..16a10c7232a1 100644
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -772,7 +772,7 @@ Reg2Py(BYTE *retDataBuf, DWORD retDataSize, DWORD typ)
                         return NULL;
                     }
                     PyList_SET_ITEM(obData, index, uni);
-                    len -= slen + 1;
+                    len -= Py_SAFE_DOWNCAST(slen + 1, size_t, int);
                 }
                 PyMem_Free(str);
 



More information about the Python-checkins mailing list