summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-11-24 09:32:55 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-11-27 16:41:04 +0000
commit916c2953b19bee7dfdd6373e5c2b047c2e90500f (patch)
treec4e1e6bc3041afe987bca6661e4550f5a45ae1f5 /src/gui
parent16c4c10aa0ea2a0dfba2000c00da7de48e1da661 (diff)
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>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/painting/qpen.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index 1c06567a32..70d56297cb 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -653,12 +653,15 @@ qreal QPen::widthF() const
*/
void QPen::setWidth(int width)
{
- if (width < 0)
- qWarning("QPen::setWidth: Setting a pen width with a negative value is not defined");
+ if (width < 0 || width >= (1 << 15)) {
+ qWarning("QPen::setWidth: Setting a pen width that is out of range");
+ return;
+ }
if ((qreal)width == d->width)
return;
detach();
d->width = width;
+ d->defaultWidth = false;
}
/*!
@@ -677,8 +680,8 @@ void QPen::setWidth(int width)
void QPen::setWidthF(qreal width)
{
- if (width < 0.f) {
- qWarning("QPen::setWidthF: Setting a pen width with a negative value is not defined");
+ if (width < 0.f || width >= (1 << 15)) {
+ qWarning("QPen::setWidthF: Setting a pen width that is out of range");
return;
}
if (qAbs(d->width - width) < 0.00000001f)