]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
repeatStoreSparseOptimalP: make diff a u32
authorJustin Viiret <justin.viiret@intel.com>
Tue, 10 Nov 2015 05:18:42 +0000 (16:18 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 18 Nov 2015 04:26:11 +0000 (15:26 +1100)
As delta is a u32, we know diff will always fit within a u32 as well.
Silences a warning from Coverity.

src/nfa/repeat.c

index 92b61874ec2734d4fc1429f7f3a5f7a4aa81011a..c1ff51622a9acf27beb630b5fa37164c2d26ca56 100644 (file)
@@ -1414,7 +1414,8 @@ void repeatStoreSparseOptimalP(const struct RepeatInfo *info,
         }
     }
 
-    u64a diff = delta - patch * patch_size;
+    assert((u64a)patch * patch_size <= delta);
+    u32 diff = delta - patch * patch_size;
     const u64a *repeatTable = getImplTable(info);
     val += repeatTable[diff];