From c90c39ff7bf2112616813f609bee4443ae8a715c Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Thu, 29 Nov 2018 03:05:20 +0100 Subject: [PATCH] catalog: reject entries where the language is too short early Closes https://oss-fuzz.com/testcase-detail/5674475278827520 --- src/journal/catalog.c | 2 +- ...clusterfuzz-testcase-minimized-fuzz-catalog-5674475278827520 | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 test/fuzz/fuzz-catalog/clusterfuzz-testcase-minimized-fuzz-catalog-5674475278827520 diff --git a/src/journal/catalog.c b/src/journal/catalog.c index 63d27337b5..0f18d31add 100644 --- a/src/journal/catalog.c +++ b/src/journal/catalog.c @@ -217,7 +217,7 @@ static int catalog_entry_lang(const char* filename, int line, size_t c; c = strlen(t); - if (c == 0) + if (c < 2) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "[%s:%u] Language too short.", filename, line); diff --git a/test/fuzz/fuzz-catalog/clusterfuzz-testcase-minimized-fuzz-catalog-5674475278827520 b/test/fuzz/fuzz-catalog/clusterfuzz-testcase-minimized-fuzz-catalog-5674475278827520 new file mode 100644 index 0000000000..2594f49df0 --- /dev/null +++ b/test/fuzz/fuzz-catalog/clusterfuzz-testcase-minimized-fuzz-catalog-5674475278827520 @@ -0,0 +1,2 @@ +-- ae2f7b866b0347b9af31fe1c80b127c0 ÿ + \ No newline at end of file