]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
Fix Klocwork scan issues.
authorChang, Harry <harry.chang@intel.com>
Sun, 27 Dec 2020 12:04:55 +0000 (12:04 +0000)
committerKonstantinos Margaritis <markos@users.noreply.github.com>
Mon, 25 Jan 2021 12:13:13 +0000 (14:13 +0200)
src/nfagraph/ng_literal_analysis.cpp
tools/hsbench/engine_hyperscan.h
tools/hsbench/engine_pcre.h
tools/hsbench/main.cpp

index ea0def0218aa94f465514d8048cf10be93f13421..d25ac43e8755cd465ab2f5e9013fdfda981793bf 100644 (file)
@@ -69,14 +69,14 @@ struct LitGraphVertexProps {
     LitGraphVertexProps() = default;
     explicit LitGraphVertexProps(ue2_literal::elem c_in) : c(move(c_in)) {}
     ue2_literal::elem c; // string element (char + bool)
-    size_t index; // managed by ue2_graph
+    size_t index = 0; // managed by ue2_graph
 };
 
 struct LitGraphEdgeProps {
     LitGraphEdgeProps() = default;
     explicit LitGraphEdgeProps(u64a score_in) : score(score_in) {}
     u64a score = NO_LITERAL_AT_EDGE_SCORE;
-    size_t index; // managed by ue2_graph
+    size_t index = 0; // managed by ue2_graph
 };
 
 struct LitGraph
index 253ec9aaaecefd851688ca9c65829ebfe04033d5..afbdf098d591072437ac0aa8092cd8cd8e1051c0 100644 (file)
@@ -65,8 +65,8 @@ public:
 class EngineHSStream : public EngineStream {
 public:
     ~EngineHSStream();
-    hs_stream_t *id;
-    EngineHSContext *ctx;
+    hs_stream_t *id = nullptr;
+    EngineHSContext *ctx = nullptr;
 };
 
 /** Hyperscan Engine for scanning data. */
index d121581f44692c98115d97e0db0be12665c001e2..9569bef480dbe9cd1cbf795f37253339fd638d16 100644 (file)
@@ -62,7 +62,7 @@ public:
 struct PcreDB {
     bool highlander = false;
     bool utf8 = false;
-    u32 id;
+    u32 id = 0;
     pcre *db = nullptr;
     pcre_extra *extra = nullptr;
 };
index 3349ecc81a54d5a263f5064f931b51cea6d31861..1c91813b281a3740945bf43c29b71b1d15e3951d 100644 (file)
@@ -877,6 +877,7 @@ void displayCsvResults(const vector<unique_ptr<ThreadContext>> &threads,
     printf(",\"%0.3f\"", totalSecs);
     printf(",\"%0.2Lf\"", calc_mbps(totalSecs, totalBytes));
 
+    assert(bytesPerRun);
     double matchRate = ((double)matchesPerRun * 1024) / bytesPerRun;
     printf(",\"%llu\"", matchesPerRun);
     printf(",\"%0.3f\"", matchRate);