diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h index 86ecf2386..48f91d600 100644 --- a/include/flatbuffers/base.h +++ b/include/flatbuffers/base.h @@ -382,6 +382,7 @@ template __supress_ubsan__("alignment") void WriteScalar(void *p, Of // Computes how many bytes you'd have to pad to be able to write an // "scalar_size" scalar if the buffer had grown to "buf_size" (downwards in // memory). +__supress_ubsan__("unsigned-integer-overflow") inline size_t PaddingBytes(size_t buf_size, size_t scalar_size) { return ((~buf_size) + 1) & (scalar_size - 1); }