From: Hong, Yang A Date: Thu, 4 Mar 2021 16:13:46 +0000 (+0000) Subject: literal API: add empty string check. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c81a6d14b0c370a2719ba13931114c2c2b2e929b;p=thirdparty%2Fvectorscan.git literal API: add empty string check. fixes github issue #302, #304 --- diff --git a/src/compiler/compiler.cpp b/src/compiler/compiler.cpp index 32836834..35f46b3f 100644 --- a/src/compiler/compiler.cpp +++ b/src/compiler/compiler.cpp @@ -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);