-
-
Notifications
You must be signed in to change notification settings - Fork 73
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 possible type confusion with boost::locale::collator
#216
Conversation
Reproducer for crash due to type confusin as reported in boostorg#210 (comment)
The value is always non-NULL so return a reference instead.
The default level is "identical" not "primary". Also fix some typos in the documentation.
As documented this should throw on construction not on use.
- Remove single-use local variables - Use nullptr instead of 0 - Assert return value
de63567
to
bc202ac
Compare
The class derived from `std::collate` which is always present in `std::locale`. So checks for the `boost::locale::collator` facet may return wrongly true. As a fix make this an independent facet with its own ID. Use an adapter such that a std::collate derived class can use its abilities.
bc202ac
to
f29d950
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #216 +/- ##
===========================================
+ Coverage 95.66% 95.71% +0.05%
===========================================
Files 115 116 +1
Lines 9885 9919 +34
===========================================
+ Hits 9456 9494 +38
+ Misses 429 425 -4
Continue to review full report in Codecov by Sentry.
|
Small but important note: if the facet isn't derived from the std::locale can be used as replacement for |
Yes but we have 2 things here: I split those 2 into 2 classes because not all backends implement |
Yes I understand that
Something that was direct upgrade path from existing locales (BTW collation is something that actually works with standard locale on Linux quite ok) I don't know how many users will actually be affected but this is something to think about - if it is worth breaking the code. |
Being derived from
This still works as mentioned before. See especially https://github.com/boostorg/locale/pull/216/files#diff-9061a93b241603967564b57e006fdb1956988bbc54d82af2d5d3228e99634914
What exactly "works with standard locale on Linux quite ok"? Is that affected by this PR anyhow?
I don't think this affects many users. The only ones where code will be broken is if they assume |
The class derived from
std::collate
which is always present instd::locale
.So checks for the
boost::locale::collator
facet may return wrongly true.As a fix make this an independent facet with its own ID.
Use an adapter such that a std::collate derived class can use its abilities.
Add tests to detect the issue and verify the fix.
Fixes #215