You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BINARY_OP_INPLACE_ADD_UNICODE has wrong reference count management #143401
The problem is that we are not checking for uniqueness of the reference before appending to it. This is incorrect as it may in-place append something that is not safe to do so.
The only reason why this never surfaced is that we never used LHS and immediately trashed it. Since it was always borrowed, the close is a no-op, and that just never causes a UAF. For correctness sake and to spare other contributors from stumbling over this bug (like the one I was helping did), which should fix it.
The fix is to check for !_PyObject_IsUniquelyReferenced(*target_local) and deopt if true.
While I think this affects 3.14 too, it should never manifest in practice. So let's just fix this on main.
Activity