From b7788b5655a3031fa741e9bf5ef4dce928104d48 Mon Sep 17 00:00:00 2001 From: Catena cyber <35799796+catenacyber@users.noreply.github.com> Date: Tue, 18 May 2021 18:30:39 +0200 Subject: [PATCH] fast-dds: use upstream without patch (#5794) --- projects/fast-dds/Dockerfile | 1 - projects/fast-dds/build.sh | 1 - projects/fast-dds/patch.diff | 74 ------------------------------------ 3 files changed, 76 deletions(-) delete mode 100644 projects/fast-dds/patch.diff diff --git a/projects/fast-dds/Dockerfile b/projects/fast-dds/Dockerfile index df5782e63..414d421d9 100644 --- a/projects/fast-dds/Dockerfile +++ b/projects/fast-dds/Dockerfile @@ -21,6 +21,5 @@ RUN git clone --depth 1 https://github.com/chriskohlhoff/asio/ RUN git clone --depth 1 https://github.com/eProsima/Fast-CDR.git RUN git clone --depth 1 https://github.com/eProsima/foonathan_memory_vendor.git RUN git clone --depth 1 https://github.com/eProsima/Fast-DDS.git -COPY patch.diff $SRC COPY build.sh $SRC WORKDIR $SRC/Fast-DDS diff --git a/projects/fast-dds/build.sh b/projects/fast-dds/build.sh index 4acf55927..74c460f52 100755 --- a/projects/fast-dds/build.sh +++ b/projects/fast-dds/build.sh @@ -47,7 +47,6 @@ cmake --build . --target install ) # build project -git apply ../patch.diff mkdir build && cd build cmake .. -DBUILD_SHARED_LIBS=OFF make -j $(nproc) diff --git a/projects/fast-dds/patch.diff b/projects/fast-dds/patch.diff deleted file mode 100644 index e4f0ba2ed..000000000 --- a/projects/fast-dds/patch.diff +++ /dev/null @@ -1,74 +0,0 @@ -diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt -index b7fb777..615e955 100644 ---- a/src/cpp/CMakeLists.txt -+++ b/src/cpp/CMakeLists.txt -@@ -484,6 +484,11 @@ elseif(NOT EPROSIMA_INSTALLER) - endif() - endif() - -+if(DEFINED ENV{LIB_FUZZING_ENGINE}) -+ add_executable(fuzz_processCDRMsg rtps/messages/fuzz_processCDRMsg.cpp) -+ target_link_libraries(fuzz_processCDRMsg ${PROJECT_NAME} $ENV{LIB_FUZZING_ENGINE}) -+endif() -+ - ############################################################################### - # Packaging - ############################################################################### -diff --git a/src/cpp/rtps/messages/MessageReceiver.cpp b/src/cpp/rtps/messages/MessageReceiver.cpp -index 962ca9b..0e82082 100644 ---- a/src/cpp/rtps/messages/MessageReceiver.cpp -+++ b/src/cpp/rtps/messages/MessageReceiver.cpp -@@ -324,7 +324,11 @@ void MessageReceiver::processCDRMsg( - - reset(); - -+#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -+ GuidPrefix_t participantGuidPrefix; -+#else - GuidPrefix_t participantGuidPrefix = participant_->getGuid().guidPrefix; -+#endif - dest_guid_prefix_ = participantGuidPrefix; - - msg->pos = 0; //Start reading at 0 -@@ -513,7 +517,9 @@ void MessageReceiver::processCDRMsg( - submessage->pos = next_msg_pos; - } - -+#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION - participant_->assert_remote_participant_liveliness(source_guid_prefix_); -+#endif - } - - bool MessageReceiver::checkRTPSHeader( -diff --git a/src/cpp/rtps/messages/fuzz_processCDRMsg.cpp b/src/cpp/rtps/messages/fuzz_processCDRMsg.cpp -new file mode 100644 -index 0000000..6a71817 ---- /dev/null -+++ b/src/cpp/rtps/messages/fuzz_processCDRMsg.cpp -@@ -0,0 +1,26 @@ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { -+ const eprosima::fastrtps::rtps::Locator_t remoteLocator; -+ eprosima::fastrtps::rtps::MessageReceiver* rcv = new eprosima::fastrtps::rtps::MessageReceiver(NULL, 4096); -+ -+ eprosima::fastrtps::rtps::CDRMessage_t msg(0); -+ msg.wraps = true; -+ msg.buffer = const_cast(data); -+ msg.length = size; -+ msg.max_size = size; -+ msg.reserved_size = size; -+ -+ // TODO: Should we unlock in case UnregisterReceiver is called from callback ? -+ rcv->processCDRMsg(remoteLocator, &msg); -+ delete rcv; -+ return 0; -+} -+