Skip to content

Commit 30e885e

Browse files
committed
messages: ensure unsigned value does not wrap
1 parent 130e195 commit 30e885e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ulog_cpp/messages.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ class Value {
430430
T v;
431431
int total_offset = offset + array_offset * sizeof(T);
432432
if (backing_start > backing_end ||
433-
backing_end - backing_start - total_offset < static_cast<int64_t>(sizeof(v))) {
433+
backing_end - backing_start < static_cast<int64_t>(sizeof(v)) + total_offset) {
434434
throw AccessException("Unexpected data type size");
435435
}
436436
std::copy(backing_start + total_offset, backing_start + total_offset + sizeof(v),

0 commit comments

Comments
 (0)