So, I ASSume that it would be legal to shoot a bear in self-defense.
In Alaska and Russia, where I sometimes work as a Bear Guard for Oil Field Workers, Scientists and / or Wildlife Photographers, yes it is perfectly lawful to shoot any animal in self defense or defense of a third party.
I strongly suspect the same is true in many other places.
Nonetheless, I strongly recommend checking the laws before carrying a firearm in unfamiliar jurisdictions.
In my personal bear encounters (easily 200+ at very close range, grizzly, black and polar), I have found them to be like 200 people.
Most of them don’t bite.
That said, I would never turn my back on a human I was unfamiliar with or a bear either one.