mirror of
https://github.com/python/cpython.git
synced 2026-04-14 07:41:00 +00:00
gh-145122: Add _GUARD_NOS_ANY_DICT to prevent STORE_SUBSCR_DICT on frozendict (gh-145039)
This commit is contained in:
parent
4c95ad8e49
commit
0f759f1171
10 changed files with 1244 additions and 1079 deletions
|
|
@ -1057,17 +1057,22 @@ dummy_func(
|
|||
}
|
||||
|
||||
op(_GUARD_NOS_DICT, (nos, unused -- nos, unused)) {
|
||||
PyObject *o = PyStackRef_AsPyObjectBorrow(nos);
|
||||
EXIT_IF(!PyDict_CheckExact(o));
|
||||
}
|
||||
|
||||
op(_GUARD_NOS_ANY_DICT, (nos, unused -- nos, unused)) {
|
||||
PyObject *o = PyStackRef_AsPyObjectBorrow(nos);
|
||||
EXIT_IF(!PyAnyDict_CheckExact(o));
|
||||
}
|
||||
|
||||
op(_GUARD_TOS_DICT, (tos -- tos)) {
|
||||
op(_GUARD_TOS_ANY_DICT, (tos -- tos)) {
|
||||
PyObject *o = PyStackRef_AsPyObjectBorrow(tos);
|
||||
EXIT_IF(!PyAnyDict_CheckExact(o));
|
||||
}
|
||||
|
||||
macro(BINARY_OP_SUBSCR_DICT) =
|
||||
_GUARD_NOS_DICT + unused/5 + _BINARY_OP_SUBSCR_DICT + POP_TOP + POP_TOP;
|
||||
_GUARD_NOS_ANY_DICT + unused/5 + _BINARY_OP_SUBSCR_DICT + POP_TOP + POP_TOP;
|
||||
|
||||
op(_BINARY_OP_SUBSCR_DICT, (dict_st, sub_st -- res, ds, ss)) {
|
||||
PyObject *sub = PyStackRef_AsPyObjectBorrow(sub_st);
|
||||
|
|
@ -2934,7 +2939,7 @@ dummy_func(
|
|||
INPUTS_DEAD();
|
||||
}
|
||||
|
||||
macro(CONTAINS_OP_DICT) = _GUARD_TOS_DICT + unused/1 + _CONTAINS_OP_DICT + POP_TOP + POP_TOP;
|
||||
macro(CONTAINS_OP_DICT) = _GUARD_TOS_ANY_DICT + unused/1 + _CONTAINS_OP_DICT + POP_TOP + POP_TOP;
|
||||
|
||||
op(_CONTAINS_OP_DICT, (left, right -- b, l, r)) {
|
||||
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue