}
inline unsigned int length_at (unsigned int index) const
- { return offset_at (index + 1) - offset_at (index); }
+ {
+ if (likely ((offset_at (index + 1) >= offset_at (index)) &&
+ (offset_at (index + 1) <= offset_at (count))))
+ return offset_at (index + 1) - offset_at (index);
+ else
+ return 0;
+ }
inline const char *data_base (void) const
{ return (const char *)this + min_size + offset_array_size (); }
inline ByteStr operator [] (unsigned int index) const
{
if (likely (index < count))
- return ByteStr (data_base () + offset_at (index) - 1, offset_at (index + 1) - offset_at (index));
+ return ByteStr (data_base () + offset_at (index) - 1, length_at (index));
else
return Null(ByteStr);
}