hrev47151 adds 1 changeset to branch 'master' old head: 574dbabb009af4871e89b303ca20388da2b3f42e new head: de3e2b51862c5213818cec2776b3fa1bc43d1bfc overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=de3e2b5+%5E574dbab ---------------------------------------------------------------------------- de3e2b5: 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. [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev47151 Commit: de3e2b51862c5213818cec2776b3fa1bc43d1bfc URL: http://cgit.haiku-os.org/haiku/commit/?id=de3e2b5 Author: Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> Date: Tue Apr 22 08:42:06 2014 UTC ---------------------------------------------------------------------------- 1 file changed, 4 insertions(+) src/kits/interface/Gradient.cpp | 4 ++++ ---------------------------------------------------------------------------- diff --git a/src/kits/interface/Gradient.cpp b/src/kits/interface/Gradient.cpp index b4cfc2a..ce922d4 100644 --- a/src/kits/interface/Gradient.cpp +++ b/src/kits/interface/Gradient.cpp @@ -305,6 +305,10 @@ BGradient::SetColorStops(const BGradient& other) int32 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) ColorStop* stop = new ColorStop(color, offset); int32 index = 0;