QStringRef: fix UB (signed overflow) in at()
In Qt 6, on 64-bit platforms, the underlying QString can hold more
than 2Gi characters, and a QStringRef, even though limited in
position() and size() to < INT_MAX, can legitimately reference a
portion of the QString that reaches beyond INT_MAX,
e.g. QStringRef(&s, INT_MAX/2, INT_MAX) on a 1.5*INT_MAX-sized 's'.
In that case, the addition of at()'s argument to m_position can
overflow, which a) is UB and b) can false-positively raise a Q_ASSERT
in QString::at().
To fix, do the calculation in qsizetype space.
As a drive-by, replace Q_ASSERT with Q_PRE.
Amends the port of QString from int to qsizetype size_type (6.0).
Pick-to: 6.12 6.11 6.8 6.5
Change-Id: Ied0f11b83d6e90b1e71c55089b99513f7f4b767e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>