]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
ng_small_literal_set: pre-check for narrow reach
authorJustin Viiret <justin.viiret@intel.com>
Tue, 20 Jun 2017 03:49:46 +0000 (13:49 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Mon, 21 Aug 2017 01:10:11 +0000 (11:10 +1000)
src/nfagraph/ng_small_literal_set.cpp

index 1d7be65b9e3dba0a1ebdfc560d115f2ad055806f..fb191efa0488d5e11c04d4f3c5511a0c78c5b390 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -33,8 +33,8 @@
 #include "ng_small_literal_set.h"
 
 #include "grey.h"
-#include "ng_util.h"
 #include "ng_holder.h"
+#include "ng_util.h"
 #include "rose/rose_build.h"
 #include "util/compare.h"
 #include "util/compile_context.h"
@@ -222,6 +222,11 @@ bool handleSmallLiteralSets(RoseBuild &rose, const NGHolder &g,
         return false;
     }
 
+    if (!hasNarrowReachVertex(g, MAX_LITERAL_SET_SIZE * 2 + 1)) {
+        DEBUG_PRINTF("vertex with wide reach found\n");
+        return false;
+    }
+
     DEBUG_PRINTF("looking for literals\n");
 
     map<sls_literal, ue2::flat_set<ReportID>> literals;