ucstricmp8: fix Coverity ARRAY_VS_SINGLETON issue
Coverity has this checker where it complains if you use a T as a T[1]. The C++ standard says this is fine¹, but qstring.cpp, specifically, is security-critical, so we shouldn't leave Coverity issues unfixed in there. So replace uc1 with a decoded[1] array and make both output and uc1 point to decoded's first (and only) element. Amends 45838673df6e64a6fd42570c4e8874c5181f7717. ¹ https://eel.is/c++draft/basic.compound#3.sentence-11 Pick-to: 6.8 6.5 Coverity-Id: 378348 Change-Id: Ib149386defd8b263df522a4f12b1af1b3fc1a20c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 4eb9e0d3eedfc1b6de968308167af01b19f6ffe7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
ece3fefdd0
commit
3c1b01ec3e
@ -1243,8 +1243,9 @@ Q_NEVER_INLINE static int ucstricmp8(const char *utf8, const char *utf8end, cons
|
||||
QStringIterator src2(utf16, utf16end);
|
||||
|
||||
while (src1 < end1 && src2.hasNext()) {
|
||||
char32_t uc1 = 0;
|
||||
char32_t *output = &uc1;
|
||||
char32_t decoded[1];
|
||||
char32_t *output = decoded;
|
||||
char32_t &uc1 = decoded[0];
|
||||
uchar b = *src1++;
|
||||
const qsizetype res = QUtf8Functions::fromUtf8<QUtf8BaseTraits>(b, output, src1, end1);
|
||||
if (res < 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user