Skip to content

Commit

Permalink
[3.12] gh-102509: Start initializing ob_digit of _PyLongValue (GH…
Browse files Browse the repository at this point in the history
…-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>
  • Loading branch information
miss-islington and illia-v authored Jul 31, 2023
1 parent 54aaaad commit 8f080a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Start initializing ``ob_digit`` during creation of :c:type:`PyLongObject`
objects. Patch by Illia Volochii.
3 changes: 3 additions & 0 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ _PyLong_New(Py_ssize_t size)
}
_PyLong_SetSignAndDigitCount(result, size != 0, size);
_PyObject_Init((PyObject*)result, &PyLong_Type);
/* The digit has to be initialized explicitly to avoid
* use-of-uninitialized-value. */
result->long_value.ob_digit[0] = 0;
return result;
}

Expand Down

0 comments on commit 8f080a2

Please sign in to comment.