AdamKorcz commented on code in PR #453: URL: https://github.com/apache/logging-log4cxx/pull/453#discussion_r1921071804
########## src/fuzzers/cpp/JSONLayoutFuzzer.cpp: ########## @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "stdint.h" +#include <log4cxx/logstring.h> +#include <log4cxx/ndc.h> +#include <log4cxx/helpers/stringhelper.h> +#include <fuzzer/FuzzedDataProvider.h> +#include <log4cxx/mdc.h> +#include <log4cxx/jsonlayout.h> + +using namespace log4cxx; +using namespace log4cxx::helpers; +using namespace log4cxx::spi; + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + // Setup JSONLayout + JSONLayout layout; + + FuzzedDataProvider fdp(data, size); + + // Optional locationinfo + if (fdp.ConsumeBool()) { + layout.setOption(LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")); Review Comment: https://github.com/apache/logging-log4cxx/pull/453/commits/26b6000a3cdf7a2287a2669647e1aa15f374ce5f Thank you! ########## src/fuzzers/cpp/JSONLayoutFuzzer.cpp: ########## @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "stdint.h" +#include <log4cxx/logstring.h> +#include <log4cxx/ndc.h> +#include <log4cxx/helpers/stringhelper.h> +#include <fuzzer/FuzzedDataProvider.h> +#include <log4cxx/mdc.h> +#include <log4cxx/jsonlayout.h> + +using namespace log4cxx; +using namespace log4cxx::helpers; +using namespace log4cxx::spi; + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + // Setup JSONLayout + JSONLayout layout; + + FuzzedDataProvider fdp(data, size); + + // Optional locationinfo + if (fdp.ConsumeBool()) { + layout.setOption(LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")); + } + // Optional threadinfo + if (fdp.ConsumeBool()) { + layout.setOption(LOG4CXX_STR("THREADINFO"), LOG4CXX_STR("threadinfo")); Review Comment: https://github.com/apache/logging-log4cxx/pull/453/commits/26b6000a3cdf7a2287a2669647e1aa15f374ce5f Thank you! ########## src/fuzzers/cpp/JSONLayoutFuzzer.cpp: ########## @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "stdint.h" +#include <log4cxx/logstring.h> +#include <log4cxx/ndc.h> +#include <log4cxx/helpers/stringhelper.h> +#include <fuzzer/FuzzedDataProvider.h> +#include <log4cxx/mdc.h> +#include <log4cxx/jsonlayout.h> + +using namespace log4cxx; +using namespace log4cxx::helpers; +using namespace log4cxx::spi; + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + // Setup JSONLayout + JSONLayout layout; + + FuzzedDataProvider fdp(data, size); + + // Optional locationinfo + if (fdp.ConsumeBool()) { + layout.setOption(LOG4CXX_STR("LOCATIONINFO"), LOG4CXX_STR("locationinfo")); + } + // Optional threadinfo + if (fdp.ConsumeBool()) { + layout.setOption(LOG4CXX_STR("THREADINFO"), LOG4CXX_STR("threadinfo")); + } + // Optional prettyprint + if (fdp.ConsumeBool()) { + layout.setOption(LOG4CXX_STR("PRETTYPRINT"), LOG4CXX_STR("prettyprint")); Review Comment: https://github.com/apache/logging-log4cxx/pull/453/commits/26b6000a3cdf7a2287a2669647e1aa15f374ce5f Thank you! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org