Limit pen width to maximal 32767
Fixes oss-fuzz 25195 Change-Id: I8c68cf71f6702d8b1b1a2ddda3284c14f02d7972 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit c7a335817e909951bfd142018f855645b4a46168) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a4fa3cce0b
commit
0c43162109
@ -653,12 +653,15 @@ qreal QPen::widthF() const
|
|||||||
*/
|
*/
|
||||||
void QPen::setWidth(int width)
|
void QPen::setWidth(int width)
|
||||||
{
|
{
|
||||||
if (width < 0)
|
if (width < 0 || width >= (1 << 15)) {
|
||||||
qWarning("QPen::setWidth: Setting a pen width with a negative value is not defined");
|
qWarning("QPen::setWidth: Setting a pen width that is out of range");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ((qreal)width == d->width)
|
if ((qreal)width == d->width)
|
||||||
return;
|
return;
|
||||||
detach();
|
detach();
|
||||||
d->width = width;
|
d->width = width;
|
||||||
|
d->defaultWidth = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -677,8 +680,8 @@ void QPen::setWidth(int width)
|
|||||||
|
|
||||||
void QPen::setWidthF(qreal width)
|
void QPen::setWidthF(qreal width)
|
||||||
{
|
{
|
||||||
if (width < 0.f) {
|
if (width < 0.f || width >= (1 << 15)) {
|
||||||
qWarning("QPen::setWidthF: Setting a pen width with a negative value is not defined");
|
qWarning("QPen::setWidthF: Setting a pen width that is out of range");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (qAbs(d->width - width) < 0.00000001f)
|
if (qAbs(d->width - width) < 0.00000001f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user