From cdc74aaddb23975d2c786b99f5bd978b6d3d52a0 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Mon, 22 Feb 2021 21:35:53 +0100 Subject: [PATCH] Fix TopicTree OOM while fuzzing --- fuzzing/TopicTree.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fuzzing/TopicTree.cpp b/fuzzing/TopicTree.cpp index e6fea39..e823620 100644 --- a/fuzzing/TopicTree.cpp +++ b/fuzzing/TopicTree.cpp @@ -45,6 +45,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { /* Then one byte action */ if (data[4] == 'S') { + + /* Some ridiculously long topics has to be cut short (OOM) */ + if (lastString.length() > 512) { + lastString = "too long!"; + } + /* Subscribe */ if (subscribers.find(id) == subscribers.end()) {