Skip to content
Open
Changes from all commits
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
12 changes: 12 additions & 0 deletions implementation/message/src/message_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ bool message_impl::deserialize(deserializer* _from) {
payload_ = runtime::get()->create_payload();
bool is_successful = header_.deserialize(_from);
if (is_successful) {
// header_.length_ is wire-controlled and covers the SOME/IP
// fields after the length itself (the 8-byte trailer:
// request_id + proto version + iface version + msg type +
// return code) plus the payload. A valid message therefore has
// length >= VSOMEIP_SOMEIP_HEADER_SIZE; values below that wrap
// the unsigned subtraction to ~0xFFFFFFF8 and make
// payload_impl::set_capacity request a ~4GB std::vector::reserve
// per malformed message (memory-pressure DoS, even though the
// subsequent payload_->deserialize correctly refuses the read).
if (header_.length_ < VSOMEIP_SOMEIP_HEADER_SIZE) {
return false;
}
payload_->set_capacity(header_.length_ - VSOMEIP_SOMEIP_HEADER_SIZE);
is_successful = payload_->deserialize(_from);
}
Expand Down