Fix possible UB in ArrayRef construction