From 0bc7ca6e2a554e201ebd308ed549a0eb432f5011 Mon Sep 17 00:00:00 2001 From: AdamKorcz <44787359+AdamKorcz@users.noreply.github.com> Date: Sat, 5 Jun 2021 16:53:00 +0100 Subject: [PATCH] [poco] Add exception to fuzzer (#5835) --- projects/poco/json_parse_fuzzer.cc | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/projects/poco/json_parse_fuzzer.cc b/projects/poco/json_parse_fuzzer.cc index 3eab522b3..e03ff2fa9 100644 --- a/projects/poco/json_parse_fuzzer.cc +++ b/projects/poco/json_parse_fuzzer.cc @@ -11,22 +11,20 @@ limitations under the License. */ #include "Poco/JSON/JSON.h" -#include "Poco/JSON/ParserImpl.h" #include "Poco/JSON/Parser.h" +#include "Poco/JSON/ParserImpl.h" -extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) -{ - std::string json(reinterpret_cast(data), size); - Poco::JSON::Parser parser; +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + std::string json(reinterpret_cast(data), size); + Poco::JSON::Parser parser; - Poco::Dynamic::Var result; - try - { - result = parser.parse(json); - } - catch(const std::exception& e) - { - return 0; - } - return 0; + Poco::Dynamic::Var result; + try { + result = parser.parse(json); + } catch (Poco::Exception &e) { + return 0; + } catch (const std::exception &e) { + return 0; + } + return 0; }