Set the size of the buffer so it is big enough to hold the contents

This will prevent a crash later on when it tries to assign to an index
in a QString that has not been allocated.

Fixes: QTBUG-81950
Change-Id: Ia0b5648a18f15594eeca07d234bedadcfeb266ac
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Andy Shaw 2020-02-21 15:05:09 +01:00
parent 34a67b3652
commit ce55667b62

View File

@ -713,7 +713,7 @@ void QLCDNumber::paintEvent(QPaintEvent *)
void QLCDNumberPrivate::internalSetString(const QString& s)
{
Q_Q(QLCDNumber);
QString buffer;
QString buffer(ndigits, QChar());
int i;
int len = s.length();
QBitArray newPoints(ndigits);