Trigger & fix first fuzzing bug
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
// std::vector<std::string_view> topics = {"", "one", "two", "three"};
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||||
/* Create topic tree */
|
/* Create topic tree */
|
||||||
uWS::TopicTree<std::string> topicTree([](uWS::Subscriber *s, std::string &message, auto flags) {
|
uWS::TopicTree<std::string> topicTree([](uWS::Subscriber *s, std::string &message, auto flags) {
|
||||||
@@ -75,6 +77,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|||||||
if (it != subscribers.end()) {
|
if (it != subscribers.end()) {
|
||||||
topicTree.unsubscribe(it->second, lastString);
|
topicTree.unsubscribe(it->second, lastString);
|
||||||
}
|
}
|
||||||
|
} else if (data[4] == 'F') {
|
||||||
|
/* Free subscriber */
|
||||||
|
auto it = subscribers.find(id);
|
||||||
|
if (it != subscribers.end()) {
|
||||||
|
topicTree.freeSubscriber(it->second);
|
||||||
|
subscribers.erase(it);
|
||||||
|
}
|
||||||
} else if (data[4] == 'A') {
|
} else if (data[4] == 'A') {
|
||||||
/* Unsubscribe from all */
|
/* Unsubscribe from all */
|
||||||
auto it = subscribers.find(id);
|
auto it = subscribers.find(id);
|
||||||
|
|||||||
@@ -220,6 +220,20 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We also need to unlink us */
|
||||||
|
if (s->needsDrainage()) {
|
||||||
|
if (s->prev) {
|
||||||
|
s->prev->next = s->next;
|
||||||
|
}
|
||||||
|
if (s->next) {
|
||||||
|
s->next->prev = s->prev;
|
||||||
|
}
|
||||||
|
/* If we are the head, then we also need to reset the head */
|
||||||
|
if (drainableSubscribers == s) {
|
||||||
|
drainableSubscribers = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
delete s;
|
delete s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user