-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Validation in Deserializer Added validation in CDR deserialization: max buffer length is checked when deserializing fields and strings are checked for null-terminator (except for wstrings, which are serialized without null-terminator). Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> * Catch exceptions in serdata functions In serdata functions rmw_print, rmw_to_sample and rmw_from_sample catch exceptions so that correct return code is given when functions are called from ddsi. Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com> * Improve deserialisation validation Refactored the deserialisation validation functions so that sequence length is checked more properly and protection against overflows. Renamed source files for exceptions so that it conforms to ros2 / google c++ style guide. Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
- Loading branch information
Showing
11 changed files
with
379 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
rmw_cyclonedds_cpp/include/rmw_cyclonedds_cpp/deserialization_exception.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2018 to 2019 ADLINK Technology | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef RMW_CYCLONEDDS_CPP__DESERIALIZATION_EXCEPTION_HPP_ | ||
#define RMW_CYCLONEDDS_CPP__DESERIALIZATION_EXCEPTION_HPP_ | ||
|
||
#include "rmw_cyclonedds_cpp/exception.hpp" | ||
|
||
namespace rmw_cyclonedds_cpp | ||
{ | ||
|
||
class DeserializationException : public Exception | ||
{ | ||
public: | ||
explicit DeserializationException(const char * const & message); | ||
DeserializationException(const DeserializationException & ex); | ||
DeserializationException & operator=(const DeserializationException & ex); | ||
|
||
virtual ~DeserializationException() throw(); | ||
|
||
static const char * const DEFAULT_MESSAGE; | ||
}; | ||
|
||
} // namespace rmw_cyclonedds_cpp | ||
|
||
#endif // RMW_CYCLONEDDS_CPP__DESERIALIZATION_EXCEPTION_HPP_ |
40 changes: 40 additions & 0 deletions
40
rmw_cyclonedds_cpp/include/rmw_cyclonedds_cpp/exception.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2018 to 2019 ADLINK Technology | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef RMW_CYCLONEDDS_CPP__EXCEPTION_HPP_ | ||
#define RMW_CYCLONEDDS_CPP__EXCEPTION_HPP_ | ||
|
||
#include <string> | ||
#include <exception> | ||
|
||
namespace rmw_cyclonedds_cpp | ||
{ | ||
|
||
class Exception : public std::exception | ||
{ | ||
public: | ||
virtual ~Exception() throw(); | ||
virtual const char * what() const throw(); | ||
|
||
protected: | ||
explicit Exception(const char * const & message); | ||
Exception(const Exception & ex); | ||
Exception & operator=(const Exception & ex); | ||
|
||
std::string m_message; | ||
}; | ||
|
||
} // namespace rmw_cyclonedds_cpp | ||
|
||
#endif // RMW_CYCLONEDDS_CPP__EXCEPTION_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.