Repository: incubator-guacamole-server
Updated Branches:
  refs/heads/staging/0.9.12-incubating 6939142d2 -> a808a6b17


GUACAMOLE-188: Clamp alpha blending results to maximum component value (0xFF).


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/0fb567bb
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/0fb567bb
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/0fb567bb

Branch: refs/heads/staging/0.9.12-incubating
Commit: 0fb567bb53a3541a3e560087372e77a2e00114ab
Parents: 12d2956
Author: Michael Jumper <[email protected]>
Authored: Sat Feb 25 16:26:37 2017 -0800
Committer: Michael Jumper <[email protected]>
Committed: Sat Feb 25 19:57:10 2017 -0800

----------------------------------------------------------------------
 src/common/surface.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/0fb567bb/src/common/surface.c
----------------------------------------------------------------------
diff --git a/src/common/surface.c b/src/common/surface.c
index bc0c693..d135bb7 100644
--- a/src/common/surface.c
+++ b/src/common/surface.c
@@ -880,7 +880,15 @@ static void __guac_common_surface_set(guac_common_surface* 
dst,
  *     given source and destination components.
  */
 static int guac_common_surface_blend_component(int dst, int src, int alpha) {
-    return src + dst * (0xFF - alpha);
+
+    int blended = src + dst * (0xFF - alpha);
+
+    /* Do not exceed maximum component value */
+    if (blended > 0xFF)
+        return 0xFF;
+
+    return blended;
+
 }
 
 /**

Reply via email to