From ce55667b62e77902c18d9a2a62e5e323516159d7 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 21 Feb 2020 15:05:09 +0100 Subject: [PATCH] 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 Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qlcdnumber.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp index 282714843c..8ac7040ea7 100644 --- a/src/widgets/widgets/qlcdnumber.cpp +++ b/src/widgets/widgets/qlcdnumber.cpp @@ -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);