Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
5.15.11, 6.2.6, 6.4.1, 6.5.0 FF
-
None
-
5
-
f11a9b203 (6.4), 536e17372 (dev), a50b7f500 (tqtc/lts-5.15), 4e647ab8a (tqtc/lts-6.2), b8c2a0c18 (dev), 81be57a99 (6.4), 9c63b9fda (6.5), 78db5cb64 (dev), 2a865831a (tqtc/lts-6.2), 9daf3961c (tqtc/lts-5.15), 43f6e10a7 (6.5), 115b1eab8 (dev)
-
Foundation Sprint 72
Description
The C toupper/tolower functions are locale-dependent. Given the right locale (Türkiye, e.g.):
- tolower(I) is either
- ı (LATIN SMALL LETTER DOTLESS I; if representable in current charset) or
- I (unchanged; if it isn't)
- toupper(i) is either
- İ (LATIN CAPITAL LETTER I WITH DOT ABOVE; if representable) or
- i (unchanged; if it isn't)
Both results are wrong.
Also, since toupper/tolower are UB unless the argument is 0..255 or EOF, it's UB to even feed a char! You need to cast to uchar first! So, basically all our uses of toupper/tolower are UB!
Please check your respective code bases, book patches, if any, onto this ticket, and, once merged, remove your component from the Jira field.
We have QtMiscUtils::asciiToLower() in QtCore/private/qtools_p.h. It's been backported to 5.15 We don't have asciiToUpper(). You can either port to asciiToLower() or use caseCompareAscii() (which may not be available in Qt 6.2 and 5.15), or wait for asciiToUpper() (from https://codereview.qt-project.org/c/qt/qtbase/+/449457) to make its way through the branches.
It doesn't look like we have uses in public header files. If you find one, then you need to pull the code out-of-line.
Attachments
Issue Links
- relates to
-
QTBUG-108665 Only Turkish upper i-dotted (İ) key doesn't work and triggering Home key event
- Reported
- resulted in
-
QTBUG-111262 Review <ctype.h> uses [Qt]
- Open
-
QTBUG-109556 Update moc-copy in qtscxml
- Reported
- split to
-
QTBUG-109551 Review toupper use [qtvirtualkeyboard]
- Open
-
QTCREATORBUG-28612 Review toupper/tolower uses [QtCreator]
- Closed
-
QTBUG-109520 Review toupper use [QWindowsKeyMapper]
- Closed
For Gerrit Dashboard: QTBUG-109235 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
447136,3 | QNetworkRequest: Make header parsing locale-independent | dev | qt/qtbase | Status: MERGED | +2 | 0 |
447579,2 | QNetworkRequest: Make header parsing locale-independent | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |
447581,2 | QNetworkRequest: Make header parsing locale-independent | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
447582,2 | QNetworkRequest: Make header parsing locale-independent | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
449457,2 | QtMiscUtils: add missing toAsciiUpper(), use it in moc | dev | qt/qtbase | Status: MERGED | +2 | 0 |
449530,2 | QtMiscUtils: add missing toAsciiUpper(), use it in moc | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |
449531,2 | QtMiscUtils: add missing toAsciiUpper(), use it in moc | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |
449532,3 | QtMiscUtils: add missing toAsciiUpper(), use it in moc | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
449533,3 | QtMiscUtils: add missing toAsciiUpper(), use it in moc | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
449541,2 | QQmlPropertyCache: don't depend on locale for toupper | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
449762,5 | QXBMHandler: use QtMiscUtils, not <ctype.h> | dev | qt/qtbase | Status: MERGED | +2 | 0 |
449776,2 | tst_QByteArray/tst_QString: use new QtMiscUtils::toAsciiUpper() | dev | qt/qtbase | Status: MERGED | +2 | 0 |
449835,2 | tst_QByteArray/tst_QString: use new QtMiscUtils::toAsciiUpper() | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |
449840,3 | Port from <cctype> toupper() to QtMiscUtils::toAsciiUpper() | dev | qt/qtactiveqt | Status: MERGED | +2 | 0 |
449865,3 | QPdfDocument: make code locale-independent | dev | qt/qtwebengine | Status: MERGED | +2 | 0 |
450009,2 | Partially update moc copy from qtbase | dev | qt/qtscxml | Status: MERGED | +2 | 0 |
450341,2 | QXBMHandler: use QtMiscUtils, not <ctype.h> | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |
450347,2 | QPdfDocument: make code locale-independent | 6.4 | qt/qtwebengine | Status: MERGED | +2 | 0 |
450348,2 | QPdfDocument: make code locale-independent | 6.5 | qt/qtwebengine | Status: MERGED | +2 | 0 |
450608,2 | Port from <cctype> toupper() to QtMiscUtils::toAsciiUpper() | 6.5 | qt/qtactiveqt | Status: MERGED | +2 | 0 |
450609,2 | Port from <cctype> toupper() to QtMiscUtils::toAsciiUpper() | 6.4 | qt/qtactiveqt | Status: MERGED | +2 | 0 |
450611,2 | Port from <cctype> toupper() to QtMiscUtils::toAsciiUpper() | tqtc/lts-6.2 | qt/tqtc-qtactiveqt | Status: MERGED | +2 | 0 |
450612,4 | Port from <cctype> toupper() to QtMiscUtils::toAsciiUpper() | tqtc/lts-5.15 | qt/tqtc-qtactiveqt | Status: MERGED | +2 | 0 |
451602,2 | Partially update moc copy from qtbase | 6.5 | qt/qtscxml | Status: MERGED | +2 | 0 |
451603,2 | Partially update moc copy from qtbase | 6.4 | qt/qtscxml | Status: MERGED | +2 | 0 |
451604,3 | Partially update moc copy from qtbase | tqtc/lts-5.15 | qt/tqtc-qtscxml | Status: MERGED | +2 | 0 |
451605,2 | Partially update moc copy from qtbase | tqtc/lts-6.2 | qt/tqtc-qtscxml | Status: MERGED | +2 | 0 |
451662,2 | QQmlPropertyCache: don't depend on locale for toupper | 6.5 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
451663,2 | QQmlPropertyCache: don't depend on locale for toupper | 6.4 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
451664,2 | QQmlPropertyCache: don't depend on locale for toupper | tqtc/lts-5.15 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |
451665,2 | QQmlPropertyCache: don't depend on locale for toupper | tqtc/lts-6.2 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |
483510,1 | QNetworkRequest: Make header parsing locale-independent | tqtc/lts-5.15-vxworks | qt/tqtc-qtbase | Status: ABANDONED | 0 | 0 |
483522,1 | QtMiscUtils: add missing toAsciiUpper(), use it in moc | tqtc/lts-5.15-vxworks | qt/tqtc-qtbase | Status: ABANDONED | 0 | 0 |