[PATCH] Check size when generating FrameSvg background

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


Marco Martin wrote:
> On Tuesday 22 December 2009, Aurélien Gâteau wrote:
>> 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
>>
> good to go i think

OK, it's in.

Aurélien


More information about the Plasma-devel mailing list