Mazda CX-5
Mazda has announced its CX-5 2017 edition at the LA auto show. Reuters/Lucy Nicholson

Mazda Motor Corporation is recalling more than 262,000 of its cars and SUVs in the United States to fix a software glitch that can stall their engines unexpectedly. The recall will start before Aug. 26.

The recall affects Mazda6 mid-size large family sedans and CX-5 compact crossover SUVs from model years 2018 and 2019. Also being recalled are Mazda3 compact cars from 2019.

Mazda said the glitch is a software error in the computer that controls the valves as part of the vehicles' fuel-saving cylinder deactivation technology. This defect is potentially dangerous because drivers won't get any warning before the engine stalls, said Mazda.

The company said its dealers will reprogram the software at no cost to owners. Mazda said it hasn’t received reports of any accidents or injuries caused by the software problem.

The glitch is the second major recall to hit Mazda in two weeks. Late last week, the company also recalled nearly 270,000 cars equipped with problematic Takata airbags that have the potential to explode and kill passengers.

The problem in the airbags fitted to the recalled Mazdas is similar to that besetting Takata airbags in other car brands. The explosive chemicals used to inflate the airbags can deteriorate under some conditions, causing them to deploy with too much force.

This excessive explosive force from the inflators can either maim or kill car passengers. In addition, the explosion can fling shrapnel at a car’s passengers after the excessive force blasts it open.

The potentially deadly Takata airbags are installed on the passenger-side in certain 2003-2008 Mazda6, 2006-2007 Mazdaspeed6 and 2004 MPV vehicles sold in the U.S. The recall also involves 2005-2006 MPV models in certain states.

Takata has recalled more than 50 million air bag inflators have been recalled in the U.S. over the past years. Twenty-two deaths and more than 180 injuries in the U.S. have been linked to this deadly defect.