compositor: Ensure all arguments to CLAMP are signed int
authorNirbheek Chauhan <nirbheek@centricular.com>
Fri, 4 Sep 2015 20:20:41 +0000 (01:50 +0530)
committerThibault Saunier <tsaunier@gnome.org>
Fri, 4 Sep 2015 21:32:36 +0000 (23:32 +0200)
commitf1f8e465f27d41f55524fa5c6cfc90d798a310bd
tree8c8b45228452090ce12ff2852d1a7611e8970c19
parent4eea087f68a15e6fffa9fe95e0ee634fb3f0d24f
compositor: Ensure all arguments to CLAMP are signed int

If any of the arguments to CLAMP are unsigned integers, the comparison causes
an automatic conversion of the signed int to unsigned, which causes -1 to become
UINT_MAX and get clamped to the high value of the CLAMP instead of 0.

See 716 at http://c0x.coding-guidelines.com/6.3.1.8.html

Also add a test for this.

https://bugzilla.gnome.org/show_bug.cgi?id=754576
gst/compositor/compositor.c
tests/check/elements/compositor.c