An analysis of stability of the flux reconstruction formulation with applications to shock capturing