Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[20732] Improve xml loading method in fuzz_XMLProfiles #4685

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions fuzz/C++/fuzz_XMLProfiles/fuzz_XMLProfiles.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <fastrtps/Domain.h>
MiguelCompany marked this conversation as resolved.
Show resolved Hide resolved
#include <fastrtps/xmlparser/XMLProfileManager.h>
#include <fastdds/dds/domain/DomainParticipantFactory.hpp>

#include "fuzz_utils.h"

Expand All @@ -23,18 +23,7 @@ extern "C" int LLVMFuzzerTestOneInput(
return EXIT_FAILURE;
}

const char* filename = buf_to_file(data, size);

if (filename == NULL)
{
return EXIT_FAILURE;
}

// TODO change this to a func. taking buf + len (or C string)
// to avoid using `buf_to_file`
xmlparser::XMLProfileManager::loadXMLFile(filename);

if (delete_file(filename) != 0)
if (ReturnCode_t::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->load_XML_profiles_string(reinterpret_cast<const char*>(data), size))
MiguelCompany marked this conversation as resolved.
Show resolved Hide resolved
{
return EXIT_FAILURE;
}
MiguelCompany marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading