[PATCH] Check size when generating FrameSvg background

Aurélien Gâteau aurelien.gateau at canonical.com
Tue Dec 22 18:13:51 CET 2009


Marco Martin wrote:
> On Tuesday 22 December 2009, Aurélien Gâteau wrote:
>> (reviewboard seems to be down today, so sending this the old-fashioned way)
>>
>> Hi,
>>
>> Stumbled upon a bad_alloc exception in Plasma today: after some
>> debugging I found out that sometimes
>> FrameSvgPrivate::generateFrameBackground() tried to generate a
>> background of size 16777215 x 13. 16777215 is QWIDGETSIZE_MAX.
>>
>> It seems the buggy size comes from the way the System Monitor applet
>> uses Plasma::Frame, but I thought adding a generic guard in
>> generateFrameBackground() would be useful, hence the attached patch.
>>
>> Actually I am thinking it may make sense to set stricter limits, for
>> example ensuring each dimension is less than say 10000 pixels.
>>
>> What do you think about this?
>>
>> Aurélien
>>
> well, with this patch it would still break with qwidgetsizemax-1 :p
> so yeah a stricter limit would probably make sense, perhaps as a const int in 
> framesvgprivate
> 

Agreed, attached is an updated patch.

Aurélien
-------------- next part --------------
A non-text attachment was scrubbed...
Name: framesvg-check-size-before-generating.diff
Type: text/x-diff
Size: 984 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20091222/065ef0d4/attachment.bin 


More information about the Plasma-devel mailing list