-
Notifications
You must be signed in to change notification settings - Fork 434
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
UCS/CONFIG: fixed crash on incorrect value set #5987
UCS/CONFIG: fixed crash on incorrect value set #5987
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls add gtest
added test |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
bot:pipe:retest |
test/gtest/ucs/test_config.cc
Outdated
scoped_log_handler log_handler_vars(config_error_suppress); | ||
opts.set("COLOR", "magenta"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls wrap these in scope { }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapped by {}
@@ -246,6 +253,21 @@ class test_config : public ucs::test { | |||
return UCS_LOG_FUNC_RC_CONTINUE; | |||
} | |||
|
|||
static ucs_log_func_rc_t | |||
config_error_suppress(const char *file, unsigned line, const char *function, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can reuse wrap_errors_logger ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically yes, but in this case we can't check if error is handled - there is no errors counter in wrap_errors_logger
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we call wrap_errors_logger() after counting, to print err message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, wrapped
test/gtest/ucs/test_config.cc
Outdated
EXPECT_EQ(COLOR_WHITE, opts->color); | ||
EXPECT_EQ(std::string(color_names[COLOR_WHITE]), | ||
std::string(opts.get("COLOR"))); | ||
EXPECT_EQ(1, m_errors); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these can be outside the scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved outside of scope
test/gtest/ucs/test_config.cc
Outdated
m_errors++; | ||
wrap_errors_logger(file, line, function, level, comp_conf, | ||
message, ap); | ||
return UCS_LOG_FUNC_RC_STOP; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: return wrap_errors_logger(..)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
test/gtest/ucs/test_config.cc
Outdated
@@ -224,7 +224,14 @@ ucs_config_field_t car_opts_table[] = { | |||
static std::vector<std::string> config_err_exp_str; | |||
|
|||
class test_config : public ucs::test { | |||
public: | |||
test_config() { | |||
m_errors = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: m_num_errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to m_num_errors
@hoopoepg pls squash |
- there was possible double free of string when user tried to set incorrect value using ucs_config_parser_set_value function - added gtest
529eaeb
to
9d87dcb
Compare
squashed |
user tried to set incorrect value using ucs_config_parser_set_value
function
fixes #5980