Skip to content

Commit

Permalink
Refs #20732: Change xml loading method to avoid copy to a file in fuz…
Browse files Browse the repository at this point in the history
…z_XMLProfiles

Signed-off-by: elianalf <[email protected]>
  • Loading branch information
elianalf committed Apr 15, 2024
1 parent 45a88ba commit 389d59b
Showing 1 changed file with 2 additions and 13 deletions.
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>
#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))
{
return EXIT_FAILURE;
}
Expand Down

0 comments on commit 389d59b

Please sign in to comment.