+struct _SBRange {
+ size_t base;
+ size_t end;
+ _SBRange(size_t b, size_t len) : base(b), end(b+len) { }
+ bool operator < (const _SBRange& other) const { return this->base < other.base; }
+};
+
+template <class _BlobType, uint32_t _magic, class _Type>
+inline bool SuperBlobCore<_BlobType, _magic, _Type>::strictValidateBlob(size_t size /* = 0 */) const
+{
+ if (!validateBlob(size)) // verifies in-bound sub-blobs
+ return false;
+ unsigned count = mCount;
+ if (count == 0)
+ return this->length() == sizeof(SuperBlobCore); // nothing in here
+
+ std::vector<_SBRange> ranges;
+ for (unsigned ix = 0; ix < count; ++ix)
+ ranges.push_back(_SBRange(mIndex[ix].offset, this->blob(ix)->length()));
+ sort(ranges.begin(), ranges.end());
+ if (ranges[0].base != sizeof(SuperBlobCore) + count * sizeof(Index))
+ return false; // start anchor
+ for (unsigned ix = 1; ix < count; ++ix)
+ if (ranges[ix].base != ranges[ix-1].end) // nothing in between
+ return false;
+ return ranges[count-1].end == this->length(); // end anchor
+}
+