detail::string_impl: zero-initialize union and avoid redundant data() in term() - #1206
Tyagiquamar wants to merge 1 commit into
Conversation
|
An automated preview of the documentation is available at https://1206.json.prtest2.cppalliance.org/libs/json/doc/html/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-10-04 16:32:55 UTC |
|
GCOVR code coverage report https://1206.json.prtest2.cppalliance.org/gcovr/index.html Build time: 2026-10-04 16:59:37 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1206 +/- ##
========================================
Coverage 93.98% 93.98%
========================================
Files 85 85
Lines 8973 8975 +2
========================================
+ Hits 8433 8435 +2
Misses 540 540
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
|

Description
Fixes #1133.
When constructing
string_implvia the SBO path (such asstring_impl(0, sp)or the default constructor), uninitialized bytes in the union could trigger-Wmaybe-uninitializedcompiler warnings or sanitizer reports during inlining of member functions.s_{}instring_impl()andstring_impl(std::size_t, storage_ptr const&).term(), directly indexesreinterpret_cast<char*>(p_.t + 1)[n] = 0;in the non-SBO branch instead of invokingdata()which performs a redundant branch check.Testing