-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix/suppress findings reported by Coverity #216
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... to eliminate unnecessary string copies Suggested by Coverity: ``` Error: COPY_INSTEAD_OF_MOVE: src/cslinker.cc:236:29: copy_constructor_call: "fnCwe" is passed-by-value as parameter to "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const &)", when it could be moved instead. src/cslinker.cc:236:29: remediation: Use "std::move(""fnCwe"")" instead of "fnCwe". Error: COPY_INSTEAD_OF_MOVE: src/cslinker.cc:249:29: copy_constructor_call: "fnImp" is passed-by-value as parameter to "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const &)", when it could be moved instead. src/cslinker.cc:249:29: remediation: Use "std::move(""fnImp"")" instead of "fnImp". ``` Related: csutils#216
Suggested by Coverity: ``` Error: COPY_INSTEAD_OF_MOVE: src/lib/filter.cc:114:25: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/filter.cc:114:25: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/filter.cc:205:29: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::set<DefEvent, std::less<DefEvent>, std::allocator<DefEvent> >::insert(std::set<DefEvent, std::less<DefEvent>, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/filter.cc:205:29: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-cov.cc:428:28: copy_constructor_call: "str" is copied and then passed-by-reference as parameter to STL insertion function "std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::insert(std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::value_type const &)", when it could be moved instead. src/lib/parser-cov.cc:428:28: remediation: Use "std::move(""str"")" instead of "str". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-gcc.cc:552:46: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/parser-gcc.cc:552:46: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-gcc.cc:558:46: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/parser-gcc.cc:558:46: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-json-sarif.cc:205:13: copy_assignment_call: "uri" is copied in call to copy assignment for class "std::string const", when it could be moved instead. src/lib/parser-json-sarif.cc:205:30: remediation: Use "std::move(""uri"")" instead of "uri". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-json-sarif.cc:250:32: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/parser-json-sarif.cc:250:32: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-json-simple.cc:157:30: copy_constructor_call: "evt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/parser-json-simple.cc:157:30: remediation: Use "std::move(""evt"")" instead of "evt". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-json-zap.cc:144:9: copy_assignment_call: "version" is copied in call to copy assignment for class "std::string const", when it could be moved instead. src/lib/parser-json-zap.cc:144:49: remediation: Use "std::move(""version"")" instead of "version". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-xml-valgrind.cc:61:9: copy_assignment_call: "argVal" is copied in call to copy assignment for class "std::string const", when it could be moved instead. src/lib/parser-xml-valgrind.cc:61:17: remediation: Use "std::move(""argVal"")" instead of "argVal". Error: COPY_INSTEAD_OF_MOVE: src/lib/parser-xml-valgrind.cc:227:32: copy_constructor_call: "noteEvt" is copied and then passed-by-reference as parameter to STL insertion function "std::vector<DefEvent, std::allocator<DefEvent> >::push_back(std::vector<DefEvent, std::allocator<DefEvent> >::value_type const &)", when it could be moved instead. src/lib/parser-xml-valgrind.cc:227:32: remediation: Use "std::move(""noteEvt"")" instead of "noteEvt". ``` Related: csutils#216
``` Error: PASS_BY_VALUE (CWE-398): src/lib/cwe-mapper.cc:38:45: pass_by_value: Passing parameter def of type "Defect" (size 200 bytes) by value, which exceeds the low threshold of 128 bytes. ``` Closes: csutils#216
siteshwar
approved these changes
Dec 13, 2024
@siteshwar Thanks for review! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See the commit messages for details.