Supress unsigned-integer-overflow for PaddingBytes (#5647)
This commit is contained in:
parent
a8e800bd7c
commit
b20801ca40
include/flatbuffers
|
@ -382,6 +382,7 @@ template<typename T> __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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue