2.2.6.1.1 Extensible Blob Version 1 Restrictions and Validation

Before parsing the data in the blob, implementations MUST verify its validity as follows:

  1. The blob size MUST be at least four bytes.

  2. The blob MUST have a SegmentAgeUnits value in the range of 1 to 4.

  3. The blob size specified by the enclosing message MUST be equal to or larger than the size needed to accommodate the number of ENCODED_SEGMENT_AGE structures specified by SegmentAgeCount, plus four bytes for the previously specified blob layout. That includes the following.

    Specified_size >= 4 + SegmentAgeCount  * sizeof(ENCODED_SEGMENT_AGE) = 4 + SegmentAgeCount  * 4 = 4 * (SegmentAgeCount   + 1)

The previous validations MUST be carried out in the specified order and MUST be aborted at the first failure. If validation fails, the blob MUST be discarded.