Do not allow backgrounds whose width or height is more than 100000 pixels

svn path=/trunk/KDE/kdelibs/; revision=1065178
This commit is contained in:
Aurélien Gâteau 2009-12-22 17:28:22 +00:00
parent 010bcc9629
commit 2ec6326d77

View File

@ -36,6 +36,10 @@
namespace Plasma
{
// Any attempt to generate a frame whose width or height is larger than this
// will be rejected
static const int MAX_FRAME_SIZE = 100000;
FrameSvg::FrameSvg(QObject *parent)
: Svg(parent),
d(new FrameSvgPrivate(this))
@ -491,6 +495,10 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame)
kWarning() << "Invalid frame size" << size;
return;
}
if (size.width() >= MAX_FRAME_SIZE || size.height() >= MAX_FRAME_SIZE) {
kWarning() << "Not generating frame background for a size whose width or height is more than" << MAX_FRAME_SIZE << size;
return;
}
const int contentWidth = size.width() - frame->leftWidth - frame->rightWidth;
const int contentHeight = size.height() - frame->topHeight - frame->bottomHeight;