https://github.com/python/cpython/commit/b3b5278475b31713fa86eaddfcbf4f22859ce59b
commit: b3b5278475b31713fa86eaddfcbf4f22859ce59b
branch: 3.12
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2024-06-07T17:17:06+02:00
summary:
[3.12] gh-120155: Fix optimize_and_assemble_code_unit() error handling (#120231)
gh-120155: Fix optimize_and_assemble_code_unit() error handling
Don't use 'g' before it's being initialized: don't use the 'error'
label if consts_dict_keys_inorder() failed.
Fix the Coverity issue:
Error: UNINIT (CWE-457):
Python-3.12.2/Python/compile.c:7670:5: skipped_decl: Jumping over declaration
of ""g"".
Python-3.12.2/Python/compile.c:7714:5: uninit_use_in_call: Using uninitialized
value ""g.g_block_list"" when calling ""_PyCfgBuilder_Fini"".
Python-3.12.2/Python/compile.c:7714:5: uninit_use_in_call: Using uninitialized
value ""g.g_entryblock"" when calling ""_PyCfgBuilder_Fini"".
7712| Py_XDECREF(consts);
7713| instr_sequence_fini(&optimized_instrs);
7714|-> _PyCfgBuilder_Fini(&g);
7715| return co;
7716| }
files:
M Python/compile.c
diff --git a/Python/compile.c b/Python/compile.c
index 40335f6dc30af6..0cd8d6082ebfeb 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -7682,7 +7682,7 @@ optimize_and_assemble_code_unit(struct compiler_unit *u,
PyObject *const_cache,
PyCodeObject *co = NULL;
PyObject *consts = consts_dict_keys_inorder(u->u_metadata.u_consts);
if (consts == NULL) {
- goto error;
+ return NULL;
}
cfg_builder g;
if (instr_sequence_to_cfg(&u->u_instr_sequence, &g) < 0) {
_______________________________________________
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]