diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-12-22 01:50:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-22 01:50:26 (GMT) |
commit | c31943af16f885c8cf5d5a690c25c366afdb2862 (patch) | |
tree | 07f37431665e481e8d96275dbb541588e9158fe2 /Python | |
parent | 9afb0e1606cad41ed57c42ea0a53ac90433f211b (diff) | |
download | cpython-c31943af16f885c8cf5d5a690c25c366afdb2862.zip cpython-c31943af16f885c8cf5d5a690c25c366afdb2862.tar.gz cpython-c31943af16f885c8cf5d5a690c25c366afdb2862.tar.bz2 |
gh-113297: Fix segfault in compiler for with statement with 19 context managers (#113327)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/flowgraph.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/flowgraph.c b/Python/flowgraph.c index e6c824a..0e6ffbc3 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -648,7 +648,7 @@ mark_except_handlers(basicblock *entryblock) { struct _PyCfgExceptStack { - basicblock *handlers[CO_MAXBLOCKS+1]; + basicblock *handlers[CO_MAXBLOCKS+2]; int depth; }; @@ -661,6 +661,7 @@ push_except_block(struct _PyCfgExceptStack *stack, cfg_instr *setup) { if (opcode == SETUP_WITH || opcode == SETUP_CLEANUP) { target->b_preserve_lasti = 1; } + assert(stack->depth <= CO_MAXBLOCKS); stack->handlers[++stack->depth] = target; return target; } |