MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / VerifyOffset

Function VerifyOffset

native/thirdpart/flatbuffers/flatbuffers.h:2440–2451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2438 }
2439
2440 uoffset_t VerifyOffset(size_t start) const {
2441 if (!Verify<uoffset_t>(start)) return 0;
2442 auto o = ReadScalar<uoffset_t>(buf_ + start);
2443 // May not point to itself.
2444 if (!Check(o != 0)) return 0;
2445 // Can't wrap around / buffers are max 2GB.
2446 if (!Check(static_cast<soffset_t>(o) >= 0)) return 0;
2447 // Must be inside the buffer to create a pointer from it (pointer outside
2448 // buffer is UB).
2449 if (!Verify(start + o, 1)) return 0;
2450 return o;
2451 }
2452
2453 uoffset_t VerifyOffset(const uint8_t *base, voffset_t start) const {
2454 return VerifyOffset(static_cast<size_t>(base - buf_) + start);

Callers 3

VerifyFunction · 0.85
VerifyFunction · 0.85
VerifyBufferFromStartFunction · 0.85

Calls 2

CheckFunction · 0.85
VerifyFunction · 0.70

Tested by

no test coverage detected