diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index a20b5bfb2..d6b6e9a71 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -367,7 +367,7 @@ class vector_downward { } uint8_t *make_space(size_t len) { - if (buf_ > cur_ - len) { + if (len > static_cast(cur_ - buf_)) { auto old_size = size(); reserved_ += std::max(len, growth_policy(reserved_)); auto new_buf = allocator_.allocate(reserved_);