check whether segmentSize >= 0