8000 [3.12] gh-102509: Start initializing `ob_digit` of `_PyLongValue` (GH… · python/cpython@8f080a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8f080a2

Browse files
[3.12] gh-102509: Start initializing ob_digit of _PyLongValue (GH-102510) (#107464)
gh-102509: Start initializing `ob_digit` of `_PyLongValue` (GH-102510) (cherry picked from commit fc130c4) Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
1 parent 54aaaad commit 8f080a2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Start initializing ``ob_digit`` during creation of :c:type:`PyLongObject`
2+
objects. Patch by Illia Volochii.

Objects/longobject.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ _PyLong_New(Py_ssize_t size)
163163
}
164164
_PyLong_SetSignAndDigitCount(result, size != 0, size);
165165
_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;
166169
return result;
167170
}
168171

0 commit comments

Comments
 (0)
0