BGradient: don't allow out of bounds stops.
* They crash app_server if you try to use them, which is not a good idea. * we could clamp them to 0/255, but reporting the error to the user seems better.
This commit is contained in:
@@ -305,6 +305,10 @@ BGradient::SetColorStops(const BGradient& other)
|
|||||||
int32
|
int32
|
||||||
BGradient::AddColor(const rgb_color& color, float offset)
|
BGradient::AddColor(const rgb_color& color, float offset)
|
||||||
{
|
{
|
||||||
|
// Out of bounds stops would crash the app_server
|
||||||
|
if (offset < 0.f || offset > 255.f)
|
||||||
|
return -1;
|
||||||
|
|
||||||
// find the correct index (sorted by offset)
|
// find the correct index (sorted by offset)
|
||||||
ColorStop* stop = new ColorStop(color, offset);
|
ColorStop* stop = new ColorStop(color, offset);
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user