File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,9 +118,15 @@ std::vector<Suppressions::Suppression> Suppressions::parseMultiSuppressComment(s
118118 if (comment.size () < 2 )
119119 return suppressions;
120120
121- const std::size_t suppress_position = comment.find (" cppcheck-suppress" );
121+ const std::size_t first_non_blank_position = comment.find_first_not_of (" \t\n " , 2 );
122+ const std::size_t suppress_position = comment.find (" cppcheck-suppress" , 2 );
122123 if (suppress_position == std::string::npos)
123124 return suppressions;
125+ if (suppress_position != first_non_blank_position) {
126+ if (errorMessage && errorMessage->empty ())
127+ *errorMessage = " Bad multi suppression '" + comment + " '. there shouldn't have non-blank character before cppcheck-suppress" ;
128+ return suppressions;
129+ }
124130
125131 const std::size_t start_position = comment.find (" [" , suppress_position);
126132 const std::size_t end_position = comment.find (" ]" , suppress_position);
You can’t perform that action at this time.
0 commit comments