cel-cpp: fix build (#5921)

Signed-off-by: Kuat Yessenov <kuat@google.com>
This commit is contained in:
Kuat 2021-06-15 10:16:20 -07:00 committed by GitHub
parent 7602748c2b
commit a69e7d7bb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -23,5 +23,5 @@ COPY BUILD fuzz*.cc $SRC/cel-cpp/fuzz/
COPY WORKSPACE .bazelrc $SRC/
RUN cat WORKSPACE >> $SRC/cel-cpp/WORKSPACE
RUN cat .bazelrc >> $SRC/cel-cpp/.bazelrc
RUN echo "4.0.0" > $SRC/cel-cpp/.bazelversion
RUN echo "4.1.0" > $SRC/cel-cpp/.bazelversion
WORKDIR $SRC/cel-cpp

View File

@ -16,14 +16,17 @@
#include <string>
#include "parser/options.h"
#include "parser/parser.h"
#define MAX_RECURSION 0x100
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
std::string str (reinterpret_cast<const char*>(data), size);
google::api::expr::parser::ParserOptions options;
options.max_recursion_depth = MAX_RECURSION;
try {
auto parse_status = google::api::expr::parser::Parse(str, "fuzzinput", MAX_RECURSION);
auto parse_status = google::api::expr::parser::Parse(str, "fuzzinput", options);
if (!parse_status.ok()) {
parse_status.status().message();
}