There was an error while loading. Please reload this page.
ob_digit
_PyLongValue
1 parent 54aaaad commit 8f080a2Copy full SHA for 8f080a2
2 files changed
Misc/NEWS.d/next/Security/2023-03-07-21-46-29.gh-issue-102509.5ouaH_.rst
@@ -0,0 +1,2 @@
1
+Start initializing ``ob_digit`` during creation of :c:type:`PyLongObject`
2
+objects. Patch by Illia Volochii.
Objects/longobject.c
@@ -163,6 +163,9 @@ _PyLong_New(Py_ssize_t size)
163
}
164
_PyLong_SetSignAndDigitCount(result, size != 0, size);
165
_PyObject_Init((PyObject*)result, &PyLong_Type);
166
+ /* The digit has to be initialized explicitly to avoid
167
+ * use-of-uninitialized-value. */
168
+ result->long_value.ob_digit[0] = 0;
169
return result;
170
171
0 commit comments