From 0a100f4c1c1484752423ec538a26533eef5b5d24 Mon Sep 17 00:00:00 2001 From: Thomas Orgis Date: Wed, 31 Jul 2019 21:57:00 +0200 Subject: [PATCH] [mpg123] silence library error messages (#2642) * mpg123/read_fuzzer: disable error messages from libmpg123 This shall remove any error messages libmpg123 prints out during fuzzing, leaving only the crash trace at the inevitable end. --- projects/mpg123/decode_fuzzer.cc | 4 +++- projects/mpg123/read_fuzzer.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/mpg123/decode_fuzzer.cc b/projects/mpg123/decode_fuzzer.cc index 56006be9a..0f0e662f1 100644 --- a/projects/mpg123/decode_fuzzer.cc +++ b/projects/mpg123/decode_fuzzer.cc @@ -19,7 +19,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; } - ret = mpg123_open_feed(handle); + ret = mpg123_param(handle, MPG123_ADD_FLAGS, MPG123_QUIET, 0.); + if(ret == MPG123_OK) + ret = mpg123_open_feed(handle); if (ret != MPG123_OK) { mpg123_delete(handle); return 0; diff --git a/projects/mpg123/read_fuzzer.c b/projects/mpg123/read_fuzzer.c index f65871608..75e9275c0 100644 --- a/projects/mpg123/read_fuzzer.c +++ b/projects/mpg123/read_fuzzer.c @@ -63,7 +63,8 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { int error; mpg123_handle* handle = mpg123_new(NULL, &error); - if (handle == NULL) { + if (handle == NULL || mpg123_param(handle, + MPG123_ADD_FLAGS, MPG123_QUIET, 0.) != MPG123_OK) { free(outmemory); fuzzer_release_tmpfile(filename); return 0;