The test is reading beyond the pts array. It looks like this was copied from test_small_segement2 but the increment wasn't changed.
LGTM