fix #8531 (invalid range length)
Merge pull request #8533 from rfourquet/range-length

fix #8531 (invalid range length)