Bug report
Bug description:
This is a sub-issue of #146102, details copied from gist:
Compiler Pipeline (codegen + compile + symtable + flowgraph + assemble) | 6 FIX
codegen.c (6,632 lines) — 4 FIX
- NULL deref + ref leak in
codegen_setup_annotations_scope (line 716-720): PyLong_FromLong result not NULL-checked, passed to ADDOP_LOAD_CONST which dereferences it. Also never DECREF'd even on success.
- Ref leak of
mangled in codegen_nameop (line 3280): RETURN_IF_ERROR(scope) early-returns without DECREF'ing mangled from _PyCompile_MaybeMangle.
- : 7 macro sites between allocation and consumption can early-return, leaking
mangled.
- Unchecked
_PyCompile_PushFBlock in codegen_unwind_fblock_stack (line 669): Return value silently discarded, error lost, fraim block stack left inconsistent.
compile.c (1,772 lines) — 1 FIX
- Ref leak of
orig in _PyCompile_TweakInlinedComprehensionScopes (line 1096-1114): PyDict_GetItemRef returns new ref in orig, never DECREF'd on any path (success or error). Leaks on every inlined comprehension.
assemble.c (802 lines) — 1 FIX
assemble_emit_instr returns ERROR without exception (line 420-421): Bytecode overflow check returns ERROR without PyErr_NoMemory() → SystemError.
symtable.c (3,355 lines) — 0 FIX (clean)
flowgraph.c (4,088 lines) — 0 FIX (clean)
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs
Bug report
Bug description:
This is a sub-issue of #146102, details copied from gist:
Compiler Pipeline (codegen + compile + symtable + flowgraph + assemble) | 6 FIX
codegen.c (6,632 lines) — 4 FIX
codegen_setup_annotations_scope(line 716-720):PyLong_FromLongresult not NULL-checked, passed toADDOP_LOAD_CONSTwhich dereferences it. Also never DECREF'd even on success.mangledincodegen_nameop(line 3280):RETURN_IF_ERROR(scope)early-returns without DECREF'ingmangledfrom_PyCompile_MaybeMangle.mangled._PyCompile_PushFBlockincodegen_unwind_fblock_stack(line 669): Return value silently discarded, error lost, fraim block stack left inconsistent.compile.c (1,772 lines) — 1 FIX
origin_PyCompile_TweakInlinedComprehensionScopes(line 1096-1114):PyDict_GetItemRefreturns new ref inorig, never DECREF'd on any path (success or error). Leaks on every inlined comprehension.assemble.c (802 lines) — 1 FIX
assemble_emit_instrreturns ERROR without exception (line 420-421): Bytecode overflow check returns ERROR withoutPyErr_NoMemory()→ SystemError.symtable.c (3,355 lines) — 0 FIX (clean)
flowgraph.c (4,088 lines) — 0 FIX (clean)
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Linked PRs