qt6-bb10/tests/auto/corelib
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
..
animation Change license for tests files 2024-02-04 09:56:42 +01:00
global QKeyCombination: move the operators into namespace Qt 2024-07-31 15:21:36 +00:00
io QUrl::resolved: rewrite to fix some corner cases for relative URLs 2024-08-03 08:24:57 +00:00
ipc ipctestcommon.h: port away from qsnprintf() 2024-07-30 16:47:32 +00:00
itemmodels [doc] Q(Persistent)ModelIndex: document behavior of data() on invalid Q(P)MIs 2024-07-06 10:17:53 +00:00
kernel tst_QDeadlineTimer: fix format-string in toString() implementation 2024-07-22 21:00:13 +00:00
mimetypes tst_QMimeDatabase: update shared-mime-info local testing instructions 2024-07-23 22:52:53 +00:00
platform Rename target of the BSTR test in QtCore to avoid conflict 2024-07-09 14:10:16 +00:00
plugin QLibrary/Unix: update the x86-64-v3 prefix path in our search 2024-07-11 08:27:24 +00:00
serialization Tests: disable various compiler warnings 2024-07-12 00:48:40 +00:00
text Add __attribute__((format(printf()))) to q(v)nprintf() 2024-08-03 07:47:19 +00:00
thread QThread/Unix: fix normal exit/terminate() race 2024-07-11 08:27:17 +00:00
time Update CLDR Windows timezone data to v44.1 2024-06-02 15:25:00 +02:00
tools QArrayDataOps: fix FP equality comparison 2024-07-26 11:22:32 +00:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00