Open Vincent9802 opened 2 years ago
JSON_amd64.zip build and test log file
Thanks for reporting. Can you please try Release mode just to be sure?
The error seems to be happening in replace_substring
which I've recently modified. Could you re-run your test with the latest release version (3.10.5) and let me know if the error exists there as well?
Thanks for reporting. Can you please try Release mode just to be sure?
Do you mean Debug?
There's a high likelihood that this is a false positive.
Are you sure what you're doing is supported? I can find documentation that specifically states only x86 is supported (but that may have changed in subsequent releases).
Thanks for reporting. Can you please try Release mode just to be sure?
Do you mean Debug?
No, Release. We sometimes had issues that MSVC took too much memory or even had a stack overflow when executing certain tests in Debug mode.
Thanks for reporting. Can you please try Release mode just to be sure?
Do you mean Debug?
No, Release. We sometimes had issues that MSVC took too much memory or even had a stack overflow when executing certain tests in Debug mode.
I ask because this bug is specific to an amd64 Release build. Also, MSVC ASAN is apparently only supported by i368 Release builds. I'm just not sure if that has changed in subsequent VS 2019 releases (I suspect not, because the MS blog post was last updated in 2021).
Since ASAN is not finding any issues on Linux and container-overflow
is known to produce false positives because of missing ASAN annotations or mixing standard library code built with and without ASAN due to inlining, I'm confident that this bug report is invalid.
Additionally, the code in question is not particularly complicated and some of the parameters are literals. I don't see how it could fail.
With StringType = std::string
:
template<typename StringType>
inline void replace_substring(StringType& s, const StringType& f,
const StringType& t)
{
JSON_ASSERT(!f.empty());
for (auto pos = s.find(f); // find first occurrence of f
pos != StringType::npos; // make sure f was found
s.replace(pos, f.size(), t), // replace with t, and
pos = s.find(f, pos + t.size())) // find next occurrence of f
{}
}
template<typename StringType>
inline StringType escape(StringType s)
{
replace_substring(s, StringType{"~"}, StringType{"~0"});
replace_substring(s, StringType{"/"}, StringType{"~1"});
return s;
}
Thanks for reporting. Can you please try Release mode just to be sure?
Do you mean Debug?
No, Release. We sometimes had issues that MSVC took too much memory or even had a stack overflow when executing certain tests in Debug mode.
Thanks for your reply and suggestion.
This error was found when compiling this project in the latest development version of VS, and is only reproduced in ASAN mode. the same error is reported in debug mode, I apologize for not clarifying this issue, I am trying to solve the problem by setting ASAN_OPTIONS=detect_container_overflow=0.
Please try also in Release mode.
Please try also in Release mode.
Niels, he did. It's in the title. :-) That's why I had to ask for clarification the last time.
Oh boy, sorry for the confusion…
The error seems to be happening in
replace_substring
which I've recently modified. Could you re-run your test with the latest release version (3.10.5) and let me know if the error exists there as well?
@falbrechtskirchinger I've tried the latest release version b5364fa of release/3.10.5 branch. But the error still exist. And the failed error are same.
As you said 'The error seems to be happening in replace_substring
which I've recently modified.' Can you provide a link to your commit for your changes? We want to try to see if the commit before this modification has this problem.
Thanks, Lin
@falbrechtskirchinger I've tried the latest release version b5364fa of release/3.10.5 branch. But the error still exist. And the failed error are same.
As you said 'The error seems to be happening in
replace_substring
which I've recently modified.' Can you provide a link to your commit for your changes? We want to try to see if the commit before this modification has this problem.
If you've tested 3.10.5, you've already done so. My change is unreleased and also immaterial. I still think this bug report is (probably) invalid for the reasons stated above and I'm only qualifying my response because I haven't personally checked the MSSTL/libstdc++ sources for ASan annotations.
The only thing I can see is that asan may be tripping on replacing the last character of the string with a two-character string. If it's not detecting that the string container has already been expanded to accept that, it would detect that as an overflow error.
But that would still be an issue outside the library, right? AFAICT, std::string::replace
should deal with resizing the string.
I did grep through libstdc++ trunk, and std::vector
is still the only annotated container. Maybe I'll check MSSTL next.
Edit: MSSTL does appear to have annotations. The unit test for string annotations tests virtually every string function but replace()
.
Correct, I don't see anything wrong with the library code, just trying to figure out what it might be detecting.
Description
Hi All,
JSON failed to run test 'test-diagnostics_cpp11','test-json_pointer_cpp11' and 'test-unicode1_cpp11'on release configuration with MSVC on windows x64. Could you please help look at this issue or provide some workarounds? Thanks in advance.
Reproduction steps
Expected vs. actual results
Expected test pass Actual results : The following tests FAILED: 8 - test-bson_cpp11 (Failed) 25 - test-diagnostics_cpp11 (Failed) 38 - test-json_pointer_cpp11 (Failed) 61 - test-unicode1_cpp11 (Failed) Errors while running CTest
Minimal code example
Error messages
Compiler and operating system
Visual Studio 2019, Window10
Library version
git commit : af34396
Validation
develop
branch is used.