[PATCH v2 3/8] d2d1/tests: Avoid out-of-bounds access when comparing segments