summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-07-29 10:56:03 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-17 01:04:07 +0200
commitf8b773d1d4b2f153eb97578ba5e49fd43564f7fb (patch)
treeb40203508aa77d1f2dcc54c39ac0b7c3722c4ed2 /src
parentd72ff0cd09eda68a0579dc57389ecc1ee4a3b7c8 (diff)
Do not try to write too large WebP images
The WebP encoder doesn't check so we end up with undefined behavior. Change-Id: Id3a64b2be50684d07e799f97f64481ba57c02ffb Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/imageformats/webp/qwebphandler.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/imageformats/webp/qwebphandler.cpp b/src/plugins/imageformats/webp/qwebphandler.cpp
index 4d6bcbe..454d654 100644
--- a/src/plugins/imageformats/webp/qwebphandler.cpp
+++ b/src/plugins/imageformats/webp/qwebphandler.cpp
@@ -218,6 +218,10 @@ bool QWebpHandler::write(const QImage &image)
qWarning() << "source image is null.";
return false;
}
+ if (std::max(image.width(), image.height()) > WEBP_MAX_DIMENSION) {
+ qWarning() << "QWebpHandler::write() source image too large for WebP: " << image.size();
+ return false;
+ }
QImage srcImage = image;
bool alpha = srcImage.hasAlphaChannel();