mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-128212: Fix race in _PyUnicode_CheckConsistency
(GH-128367)
There was a data race on the utf8 field between `PyUnicode_SET_UTF8` and `_PyUnicode_CheckConsistency`. Use the `_PyUnicode_UTF8()` accessor, which uses an atomic load internally, to avoid the data race.
This commit is contained in:
parent
c9356feef2
commit
8eebe4e6d0
1 changed files with 1 additions and 1 deletions
|
@ -688,7 +688,7 @@ _PyUnicode_CheckConsistency(PyObject *op, int check_content)
|
|||
|| kind == PyUnicode_2BYTE_KIND
|
||||
|| kind == PyUnicode_4BYTE_KIND);
|
||||
CHECK(ascii->state.ascii == 0);
|
||||
CHECK(compact->utf8 != data);
|
||||
CHECK(_PyUnicode_UTF8(op) != data);
|
||||
}
|
||||
else {
|
||||
PyUnicodeObject *unicode = _PyUnicodeObject_CAST(op);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue