]> git.saurik.com Git - redis.git/blobdiff - src/t_zset.c
Test for ranges where min > max
[redis.git] / src / t_zset.c
index 0e7d726bfb388ede5e17ae3a0d478c6317abdadf..99fe6a8b3c5c5a782f4a7ebae22b5c2e47b46938 100644 (file)
@@ -196,6 +196,10 @@ static int zslValueInRange(double value, zrangespec *spec) {
 int zslIsInRange(zskiplist *zsl, zrangespec *range) {
     zskiplistNode *x;
 
+    /* Test for ranges that will always be empty. */
+    if (range->min > range->max ||
+            (range->min == range->max && (range->minex || range->maxex)))
+        return 0;
     x = zsl->tail;
     if (x == NULL || !zslValueInMinRange(x->score,range))
         return 0;