libreoffice-online/fuzzer/Common.cpp
Miklos Vajna 2c82f0a712 fuzzer: fix default log level
Recent a failed jenkins job had a lot of output, the tail of the log
starts with: "Skipping 3,970,746 KB".

I guessed that the problem is that the fuzzer figured out what is the
protocol to change log levels, but it isn't there yet.

What seems to happen is that fuzzer/Common.cpp defines the log level to
be "none", but this is not handled at GenericLogger::mapToLevel(), so we
managed to enable trace level for known-broken input where we're not
interested in the errors/warnings.

The fix can be tested by adding assert(false); to Log::log(), previously
the fuzzer failed with an assertion failure for a simple input like "12"
(unknown command) and now it just exits silently.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ib5f4bedca706d7a0310a2eb9f661053a3095822d
2024-05-29 09:10:44 +02:00

32 lines
743 B
C++

/*
* Copyright the Collabora Online contributors.
*
* SPDX-License-Identifier: MPL-2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <fuzzer/Common.hpp>
#include <map>
#include <string>
#include "config.h"
#include <Log.hpp>
namespace fuzzer
{
bool DoInitialization()
{
std::string logLevel("fatal");
bool withColor = false;
bool logToFile = false;
std::map<std::string, std::string> logProperties;
Log::initialize("wsd", logLevel, withColor, logToFile, logProperties);
return true;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */