Skip to content

Commit 54bedcf

Browse files
authored
gh-144012: Check null binary op extend (#144014)
1 parent 63cc125 commit 54bedcf

File tree

7 files changed

+14
-2
lines changed

7 files changed

+14
-2
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Check if the result is ``NULL`` in ``BINARY_OP_EXTENT`` opcode.

Modules/_testinternalcapi/test_cases.c.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@
359359
stack_pointer = _PyFrame_GetStackPointer(frame);
360360
stack_pointer += -2;
361361
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
362+
if (res_o == NULL) {
363+
JUMP_TO_LABEL(error);
364+
}
362365
res = PyStackRef_FromPyObjectSteal(res_o);
363366
}
364367
stack_pointer[0] = res;

Python/bytecodes.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,7 @@ dummy_func(
839839

840840
PyObject *res_o = d->action(left_o, right_o);
841841
DECREF_INPUTS();
842+
ERROR_IF(res_o == NULL);
842843
res = PyStackRef_FromPyObjectSteal(res_o);
843844
}
844845

Python/executor_cases.c.h

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)