47abdabe2c
Any QHttp1Configuration object created has 'ShortData data' as active member. std::exchange()ing or qt_ptr_swap()ping 'Private *d', then, is accessing the inactive member of the union, and that's UB. Fix by swapping and copying the whole union, as opposed to any of its members, and, in the move constructor, activating Private *d. This is now safe, as assigning to 'd' ends 'data's life-time and starts 'd's. Even if we assign a well-formed object to a moved-from object, we either swap or copy the whole union, so SEP. For self-move-assignment in the moved-from state (Hinnant Criterion), we're using std::swap() on the whole union, so SEP. In addition, activating `Private *d` in moved-from objects means that a future ~Public's use of unconditional 'delete d' won't invoke UB, either. Thanks to Peppe for insisting on fixing this. Pick-to: 6.5 Change-Id: Ic1323b8416d6b17ae21768c625de1daba0944133 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> |
||
---|---|---|
.github/workflows | ||
bin | ||
cmake | ||
coin | ||
config.tests | ||
dist | ||
doc | ||
examples | ||
lib | ||
libexec | ||
LICENSES | ||
mkspecs | ||
qmake | ||
src | ||
tests | ||
util | ||
.cmake.conf | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.tag | ||
CMakeLists.txt | ||
conanfile.py | ||
config_help.txt | ||
configure | ||
configure.bat | ||
configure.cmake | ||
dependencies.yaml | ||
qt_cmdline.cmake | ||
sync.profile |