fix #8531 (invalid range length)