| 2393 | } |
| 2394 | |
| 2395 | __supress_ubsan__("unsigned-integer-overflow") bool VerifyTableStart( |
| 2396 | const uint8_t *table) { |
| 2397 | // Check the vtable offset. |
| 2398 | auto tableo = static_cast<size_t>(table - buf_); |
| 2399 | if (!Verify<soffset_t>(tableo)) return false; |
| 2400 | // This offset may be signed, but doing the subtraction unsigned always |
| 2401 | // gives the result we want. |
| 2402 | auto vtableo = tableo - static_cast<size_t>(ReadScalar<soffset_t>(table)); |
| 2403 | // Check the vtable size field, then check vtable fits in its entirety. |
| 2404 | return VerifyComplexity() && Verify<voffset_t>(vtableo) && |
| 2405 | VerifyAlignment<voffset_t>(ReadScalar<voffset_t>(buf_ + vtableo)) && |
| 2406 | Verify(vtableo, ReadScalar<voffset_t>(buf_ + vtableo)); |
| 2407 | } |
| 2408 | |
| 2409 | template<typename T> |
| 2410 | bool VerifyBufferFromStart(const char *identifier, size_t start) { |
no test coverage detected