[Sanitizer] use proper casting in *stat functions on Mac