Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
6.5.0 Beta3
-
None
Description
I received data from a socket which contains string data with offset. When I call QString::fromWCharArray the assertion triggered, and when I switch to QString::fromStdWString everything works fine.
ASSERT: "(misalignment & 1) == 0" in file C:\Users\qt\work\qt\qtbase\src\corelib\text\qstring.cpp, line 414
void qstring_fromwchararray_test()
{
struct StructA
;
struct StructB
;
char buf[sizeof(StructA) + sizeof(StructB)];
auto sa = (StructA*)buf;
auto sb = (StructB*)&buf[sizeof(StructA)];
sa->type = 1;
memset(sb->text, 0, sizeof(sb->text));
wcscpy_s(sb->text, L"test string.");
QString qtext = QString::fromWCharArray(sb->text); // crash
qDebug() << qtext;
}
Attachments
Issue Links
- duplicates
-
QTBUG-110741 qt6 sigsegv with QString::fromUtf16
- Closed