[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:23:40 EDT 2019


https://github.com/python/cpython/commit/44729c9f5198211faf533da49fa0fa26693a1993
commit: 44729c9f5198211faf533da49fa0fa26693a1993
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-09-09T07:23:37-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 37bc2c72dcde..72a7c380beef 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