]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
literal API: add empty string check.
authorHong, Yang A <yang.a.hong@intel.com>
Thu, 4 Mar 2021 16:13:46 +0000 (16:13 +0000)
committerKonstantinos Margaritis <konstantinos@vectorcamp.gr>
Mon, 29 Aug 2022 12:08:54 +0000 (15:08 +0300)
fixes github issue #302, #304

src/compiler/compiler.cpp

index 3283683415553d58fd0ede537ce317e4cb849fa0..35f46b3fea2e7af157e6c46302f764c188136289 100644 (file)
@@ -417,6 +417,10 @@ void addLitExpression(NG &ng, unsigned index, const char *expression,
                            "HS_FLAG_SOM_LEFTMOST are supported in literal API.");
     }
 
+    if (!strcmp(expression, "")) {
+        throw CompileError("Pure literal API doesn't support empty string.");
+    }
+
     // This expression must be a pure literal, we can build ue2_literal
     // directly based on expression text.
     ParsedLitExpression ple(index, expression, expLength, flags, id);