From 184111508624fddc77431a028bf9841ffcf66205 Mon Sep 17 00:00:00 2001 From: Masahiro Sakai Date: Mon, 25 Jun 2018 13:48:02 +0900 Subject: [PATCH 1/3] fix segmentation fault in menoh_impl::extract_needed_node_list (#9) std::find_if(node_list.begin(), node_list.end(), pred) returns node_list.end() when no elements node_list satisfy the pred, therefore returned iterator must not be dereferenced without proper check. --- menoh/graph.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/menoh/graph.cpp b/menoh/graph.cpp index fb6b6f7..cd131a6 100644 --- a/menoh/graph.cpp +++ b/menoh/graph.cpp @@ -36,6 +36,8 @@ namespace menoh_impl { return output_name == required_output_name; }); }); + if (needed_node_iter==node_list.end()) + continue; auto is_already_added = std::find(needed_node_list.begin(), needed_node_list.end(), *needed_node_iter) != needed_node_list.end(); From b3d99ce2b0b135fc58c39d72b8a254053fa2e943 Mon Sep 17 00:00:00 2001 From: Masahiro Sakai Date: Mon, 25 Jun 2018 14:08:04 +0900 Subject: [PATCH 2/3] run menoh_test on Travis-CI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c3ae7d5..73005dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,4 +53,4 @@ script: .. fi - make - # - ./test/menoh_test + - ./test/menoh_test From 4b8e3d539119c801ef4c08d7612035681a20280b Mon Sep 17 00:00:00 2001 From: "s.okada" Date: Mon, 25 Jun 2018 15:43:05 +0900 Subject: [PATCH 3/3] Update graph.cpp modify style --- menoh/graph.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/menoh/graph.cpp b/menoh/graph.cpp index cd131a6..7781d09 100644 --- a/menoh/graph.cpp +++ b/menoh/graph.cpp @@ -36,8 +36,7 @@ namespace menoh_impl { return output_name == required_output_name; }); }); - if (needed_node_iter==node_list.end()) - continue; + if(needed_node_iter == node_list.end()) { continue; } auto is_already_added = std::find(needed_node_list.begin(), needed_node_list.end(), *needed_node_iter) != needed_node_list.end();