From: openocd-gerrit <ope...@us...> - 2023-11-18 11:17:06
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d4575b647a3603200a9bb4a784d170f792ab88d0 (commit) from b39072f2ef72f02601b40931d3a38c465804a906 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d4575b647a3603200a9bb4a784d170f792ab88d0 Author: Antonio Borneo <bor...@gm...> Date: Sun Nov 5 17:02:26 2023 +0100 target: fix segmentation fault on target create In the unusual (and even incorrect) case of running the command target create ... before defining an adapter and the associated transport, the command causes a segmentation fault. E.g.: openocd -c 'target create cpu cortex-m -endian little' Check that get_current_transport() returns a valid pointer before referencing it. Change-Id: I9796a7e92196ef3df5c7152b27c34102045dc9e7 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/7962 Reviewed-by: Tomas Vanek <va...@fb...> Tested-by: jenkins diff --git a/src/target/target.c b/src/target/target.c index d368cb515..148bc9fb7 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -6143,7 +6143,7 @@ static int target_create(struct jim_getopt_info *goi) if (e != JIM_OK) return e; struct transport *tr = get_current_transport(); - if (tr->override_target) { + if (tr && tr->override_target) { e = tr->override_target(&cp); if (e != ERROR_OK) { LOG_ERROR("The selected transport doesn't support this target"); ----------------------------------------------------------------------- Summary of changes: src/target/target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |