xan: check size_segment before reading, fixes out of array read.