-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
MDEV-37530 fixes #4503
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
base: MDEV-37530
Are you sure you want to change the base?
MDEV-37530 fixes #4503
Conversation
6309faa to
1b3ddf0
Compare
|
Yeah PR view doesn’t know that |
1b3ddf0 to
7e7df10
Compare
Some environments appear not to retain the backing array of a static `std::initializer_list` in the MDEV-37530 release candidate, and eventually crash when reading overwritten data. This commit resolves the stealth issue by reverting to conventional arrays, while maintaining convenience through deductive overloads.
7e7df10 to
33892e7
Compare
sql/rpl_info_file.h
Outdated
| * my_b_printf() needs updates and so doesn't | ||
| support `long long`s at the movement. |
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.
Previous discussion: #3724 (comment)
* Some of our platforms (namely SUSE 15, which uses GCC 7.5) support C++17 syntaxes, but not all libraries, <charconv> among those. * We are yet to figure out what to do with our 10 choices of string→int converters, so now is not the time to settle preferences on <charconv> or whatever superset that covers all of their cases. Co-authored-by: Sergei Golubchik <[email protected]>
Arithmetics start from `int` and so auto-promotes.
33892e7 to
8e24efe
Compare
Unlike Boolean operators, the order of operands of bit-logic operators is not guaranteed. `DBUG_ASSERT()` uses the boolean value and does not show the integer value anyway. Co-authored-by: Brandon Nesterenko <[email protected]>
vuvova
left a comment
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.
Looks ok. I'd prefer a more reusable C++ str->int approach, see inline comment.
And let Brandon review the std::initializer_list changes.
| [[fallthrough]]; | ||
| default: | ||
| return true; | ||
| } |
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.
may be (quoting from my yet-unpushed commit)
template<typename T> inline char *str2int(const char *s, size_t l, int base, T *val)
{
char *end= const_cast<char*>(s) + l;
int err;
longlong v= my_strntoll_8bit(&my_charset_latin1, s, l, base, &end, &err);
if (!err && static_cast<longlong>(*val= static_cast<T>(v)) != v)
err= EDOM;
return (errno= err) ? NULL : end;
}
template<> inline char *str2int<ulonglong>(const char *s, size_t l, int base, ulonglong *val)
{
char *end= const_cast<char*>(s) + l;
int err;
*val= my_strntoull_8bit(&my_charset_latin1, s, l, base, &end, &err);
return (errno= err) ? NULL : end;
}it's type safe and universally usable (could be in a common header). and doesn't add a new str->int, but wraps existing one.
modeled after str2int (that I want to get rid of), that's why errno. may be not the best approach.
Fix issues in MDEV-37530 (#4430) found when releasing v12.3.0 (preview).
Use array, not
std::initializer_listSome environments appear not to retain the backing array of a static
std::initializer_listin the MDEV-37530 release candidate, and eventually crash when reading overwritten data.This commit resolves the stealth issue by reverting to conventional arrays, while maintaining convenience through deductive overloads.
Avoid C++17’s
<charconv>entirely<charconv>among those.<charconv>or whatever superset that covers all of their cases.Warning fix: make
int→ucharexplicitArithmetics start from
intand so auto-promotes.Use boolean OR, not bitwise OR
Unlike Boolean operators, the order of operands of bit-logic operators is not guaranteed.
DBUG_ASSERT()uses the boolean value and does not show the integer value anyway.PR quality check
This is a new feature or a refactoring, and the PR is based on themainbranch.