summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontdatabase.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-06-14 13:09:58 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-19 10:06:44 +0000
commiteb14ce098cbf2296f4f5a7db38aca12eb2f325f3 (patch)
treec7176f09876da3b2f2455f2feaacf80799ff0c85 /src/gui/text/qfontdatabase.cpp
parentbcc7a9dd7af3a630e2fe79ded5ce0a3a7a745d5a (diff)
QRegularExpression: fix matching over null/empty QString(View)
An empty QString(View) is allowed to have nullptr as its data pointer (of course, only if its size is 0). This wasn't properly checked in QRegularExpression, which passed such nullptr to PCRE, and that resulted in PCRE raising an error (PCRE_ERROR_NULL). Detect this case and pass a dummy pointer to keep PCRE happy. Fixing and testing this in turn exposed a problem with QStringView support in QRegularExpression when used over a null QString: the code is supposed to use the QStringView(QString) constructor and NOT qToStringViewIgnoringNull. That's because QRE distinguishes null and empty subjects; when using qToStringViewIgnoringNull over a null QString, one gets a non-null QStringView (!). Again, this in turn exposed a problem with a QRegularExpression autotest that assumed that a null match could only mean "no match" (instead, it can happen at position 0 of a null QString(View)). Change-Id: Ifb3cf14dec42ce76fcdbcb07ea1d80784d52ef65 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit f0d1f50e0294e5a55a0e450993e0810bd4dbf63d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui/text/qfontdatabase.cpp')
0 files changed, 0 insertions, 0 deletions