[Python-checkins] bpo-34899: Fix a possible assertion failure due to int_from_bytes_impl() (GH-9705)

Miss Islington (bot) webhook-mailer at python.org
Fri Oct 5 17:29:00 EDT 2018


https://github.com/python/cpython/commit/1596fea0a329e1f5e4cce0135724881ca5f1d341
commit: 1596fea0a329e1f5e4cce0135724881ca5f1d341
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-10-05T14:28:56-07:00
summary:

bpo-34899: Fix a possible assertion failure due to int_from_bytes_impl() (GH-9705)


The _PyLong_FromByteArray() call in int_from_bytes_impl() was
unchecked.
(cherry picked from commit 7bb9cd0a6766fd3e7b3c1e8f2315304ae192b34c)

Co-authored-by: Zackery Spytz <zspytz at gmail.com>

files:
M Objects/longobject.c

diff --git a/Objects/longobject.c b/Objects/longobject.c
index 269d6cdea590..59c7efbfee2e 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -5270,7 +5270,7 @@ int_from_bytes_impl(PyTypeObject *type, PyObject *bytes_obj,
         little_endian, is_signed);
     Py_DECREF(bytes);
 
-    if (type != &PyLong_Type) {
+    if (long_obj != NULL && type != &PyLong_Type) {
         Py_SETREF(long_obj, PyObject_CallFunctionObjArgs((PyObject *)type,
                                                          long_obj, NULL));
     }



More information about the Python-checkins mailing list