[poco] Add exception to fuzzer (#5835)

This commit is contained in:
AdamKorcz 2021-06-05 16:53:00 +01:00 committed by GitHub
parent fdd1fe9544
commit 0bc7ca6e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 15 deletions

View File

@ -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<const char*>(data), size);
Poco::JSON::Parser parser;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
std::string json(reinterpret_cast<const char *>(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;
}