Avoid intentional unsigned integer overflow getting caught by sanitizers (#5572)
authorBjörn Harrtell <bjornharrtell@users.noreply.github.com>
Thu, 17 Oct 2019 22:47:51 +0000 (00:47 +0200)
committerWouter van Oortmerssen <aardappel@gmail.com>
Thu, 17 Oct 2019 22:47:51 +0000 (15:47 -0700)
* Avoid intentional unsigned integer overflow getting caught by sanitizers

* Adapt from suggested compiler compatible solution

* And a third way :)

include/flatbuffers/flatbuffers.h

index 228c879..a4acdf9 100644 (file)
@@ -2230,6 +2230,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
     return true;
   }
 
+  __supress_ubsan__("unsigned-integer-overflow")
   bool VerifyTableStart(const uint8_t *table) {
     // Check the vtable offset.
     auto tableo = static_cast<size_t>(table - buf_);