Handle allocation errors during message deserialization (#313) (#419)

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Co-authored-by: Michel Hidalgo <michel@ekumenlabs.com>
This commit is contained in:
Jacob Perron 2022-09-20 13:17:30 -07:00 committed by GitHub
parent 440b191ae6
commit 6d6b78f28d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 2 deletions

View file

@ -1445,6 +1445,9 @@ extern "C" rmw_ret_t rmw_deserialize(
} catch (rmw_cyclonedds_cpp::Exception & e) {
RMW_SET_ERROR_MSG_WITH_FORMAT_STRING("rmw_serialize: %s", e.what());
ok = false;
} catch (std::runtime_error & e) {
RMW_SET_ERROR_MSG_WITH_FORMAT_STRING("rmw_serialize: %s", e.what());
ok = false;
}
return ok ? RMW_RET_OK : RMW_RET_ERROR;