what is the loop prevention mechanism in OSPF?

All areas in OSPF must be connected to the area 0 in order to advertise the routes/communicate to other areas . This makes OSPF loop free even though Intra-area route exchange is distance vector.