qt6-bb10/tests/auto/corelib/io
Thiago Macieira a1610c6c68 QUrl::resolved: rewrite to fix some corner cases for relative URLs
Both issues reported in QTBUG-120396 came from the same dubious piece of
code, which predates the public Qt history

        if (path->size() >= 2 && in[0].unicode() == '.' && in[1].unicode() == '/')
            in += 2;
        else if (path->size() >= 3 && in[0].unicode() == '.'
                 && in[1].unicode() == '.' && in[2].unicode() == '/')
            in += 3;

It makes no sense to check path->size() inside the loop, as the in
pointer will have advanced past the beginning and the remaining size of
the input will not be path->size().

It additionally had theoretical UB in expressions like
  in <= end - 4
for paths that were less than 4 characters long (it cannot happen with
current QString because of the QArrayData header before the payload).

So this commit rewrites the function to fix those issues and some others
found during the unit-testing. It gives the function a major
simplification.

Fixes: QTBUG-120396
Pick-to: 6.7 6.5
Change-Id: I46feca3a447244a8ba19fffd17e012c27e410056
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 4b1547adc9b195e6acc90471fc48dec7ee0c429d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-08-03 08:24:57 +00:00
..
largefile Limit size of large files test for VxWorks 2024-05-16 14:04:41 +02:00
qabstractfileengine QDirListing: add flags to handle entries filtering 2024-06-27 01:31:40 +00:00
qbuffer Change license for tests files 2024-02-04 09:56:42 +01:00
qdataurl Change license for tests files 2024-02-04 09:56:42 +01:00
qdebug Call std::addressof instead of operator& in QDebug::toString 2024-07-25 11:21:35 +00:00
qdir tst_QDir: fix -Wunused-result 2024-06-18 08:09:11 +00:00
qdiriterator Disable copy and move of QAbstractFileEngineHandler 2024-04-19 13:56:35 +02:00
qdirlisting QDirListing: add getters for iterator flags and name filters 2024-06-27 01:31:41 +00:00
qfile QDirListing: add flags to handle entries filtering 2024-06-27 01:31:40 +00:00
qfileinfo Make tst_QFileInfo::setFileTimes more robust 2024-05-16 08:51:53 +02:00
qfileselector Handle VxWorks in QFileSelector 2024-06-19 14:02:58 +00:00
qfilesystementry Change license for tests files 2024-02-04 09:56:42 +01:00
qfilesystemmetadata Change license for tests files 2024-02-04 09:56:42 +01:00
qfilesystemwatcher Fix tst_QFileSysteMWatcher::basicTest on VxWorks 2024-05-15 18:22:39 +02:00
qiodevice Tests: check the output of QFile::open 2024-03-27 04:24:11 +01:00
qipaddress Change license for tests files 2024-02-04 09:56:42 +01:00
qlockfile Change license for tests files 2024-02-04 09:56:42 +01:00
qloggingcategory Change license for tests files 2024-02-04 09:56:42 +01:00
qloggingregistry Change license for tests files 2024-02-04 09:56:42 +01:00
qnodebug Change license for tests files 2024-02-04 09:56:42 +01:00
qprocess tst_QProcess: silence -Wunused-result 2024-06-18 08:09:23 +00:00
qprocess-noapplication Change license for tests files 2024-02-04 09:56:42 +01:00
qprocessenvironment Skip tst_QProcessEnvironment::systemEnvironment on VxWorks 2024-05-28 15:22:20 +02:00
qresourceengine Add copyright and licensing to .cpp and .h files missing them 2024-05-28 09:47:01 +02:00
qsavefile QSaveFile: don't reset fileEngine after commit() 2024-04-26 18:19:39 +02:00
qsettings tst_QSettings: port to QTEST_THROW_ON_FAIL 2024-06-27 06:06:02 +00:00
qstandardpaths wasm: Enable qstandardpaths test 2024-05-06 16:01:28 +02:00
qstorageinfo tst_QStorageInfo: port from qvsnprintf to std::vsnprintf() 2024-07-22 21:00:12 +00:00
qtemporarydir tst_qtemporarydir: refactor a test 2024-03-21 05:49:54 +02:00
qtemporaryfile tests: Fix tst_qtemporaryfile to use temporary file 2024-05-29 15:24:25 +03:00
qurl QUrl::resolved: rewrite to fix some corner cases for relative URLs 2024-08-03 08:24:57 +00:00
qurlinternal Change license for tests files 2024-02-04 09:56:42 +01:00
qurlquery QTest: rip out qxp::function_ref from compare_helper() 2024-04-26 18:19:36 +02:00
qurluts46 QUrl IDNA: Update to Unicode 15.1 2024-02-08 17:43:58 +01:00
qzip Change license for tests files 2024-02-04 09:56:42 +01:00
CMakeLists.txt tst_QSettings: port to QTEST_THROW_ON_FAIL 2024-06-27 06:06:02 +00:00