https://github.com/python/cpython/commit/fba4584ffccde789919799c38a55ce4c17ba4d8b
commit: fba4584ffccde789919799c38a55ce4c17ba4d8b
branch: main
author: Ken Jin <[email protected]>
committer: Fidget-Spinner <[email protected]>
date: 2025-12-17T17:05:21Z
summary:

gh-142849: Fix segfault in `executor_to_gv` (GH-142885)

Fix segfault in `executor_to_gv`

files:
M Python/optimizer.c

diff --git a/Python/optimizer.c b/Python/optimizer.c
index 18f54f9bc23476..fc984a5374a554 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -1977,7 +1977,7 @@ executor_to_gv(_PyExecutorObject *executor, FILE *out)
 #else
         fprintf(out, "        <tr><td port=\"i%d\" border=\"1\" >%s op0=%" 
PRIu64 "</td></tr>\n", i, opname, inst->operand0);
 #endif
-        if (inst->opcode == _EXIT_TRACE || inst->opcode == _JUMP_TO_TOP) {
+        if (base_opcode == _EXIT_TRACE || base_opcode == _JUMP_TO_TOP) {
             break;
         }
     }
@@ -1990,7 +1990,7 @@ executor_to_gv(_PyExecutorObject *executor, FILE *out)
     for (uint32_t i = 0; i < executor->code_size; i++) {
         _PyUOpInstruction const *inst = &executor->trace[i];
         uint16_t base_opcode = _PyUop_Uncached[inst->opcode];
-        uint16_t flags = _PyUop_Flags[inst->opcode];
+        uint16_t flags = _PyUop_Flags[base_opcode];
         _PyExitData *exit = NULL;
         if (base_opcode == _EXIT_TRACE) {
             exit = (_PyExitData *)inst->operand0;

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to