controller: Fix out-of-bounds detection
authorEdward Hervey <edward@collabora.com>
Tue, 10 Dec 2013 22:09:07 +0000 (17:09 -0500)
committerEdward Hervey <edward@collabora.com>
Tue, 10 Dec 2013 22:09:07 +0000 (17:09 -0500)
We want to abort if we higher than the maximum *OR* lower than the minimum
accepted value.

Detected by Coverity.

libs/gst/controller/gstinterpolationcontrolsource.c

index 0aea6cd..b8a3c22 100644 (file)
@@ -524,7 +524,7 @@ static gboolean
 {
   GstControlSource *csource = GST_CONTROL_SOURCE (self);
 
-  if (mode >= num_interpolation_modes && (int) mode < 0) {
+  if (mode >= num_interpolation_modes || (int) mode < 0) {
     GST_WARNING ("interpolation mode %d invalid or not implemented yet", mode);
     return FALSE;
   }