Making the scared dog feel less trapped may diffuse the situation.
It's best to fight the human tendency to comfort the scared dog because approaching, even with the warmest intentions, may be perceived as an aggressive act.
Regardless of the reason, aggressive dogs pose a danger to humans.