The Scrum Guide says very little about canceling a Sprint - the Product Owner can cancel a Sprint if the Sprint Goal becomes obsolete. Other criteria for canceling a Sprint, including the Sprint Goal being unachievable, are not given. Scaled Scrum frameworks also don't mention Sprint cancellation. The word "cancel" doesn't appear in the Nexus Guide, although since Nexus is Scrum, it may be implied that the Product Owner can cancel the Sprint if the Nexus Sprint Goal becomes obsolete. The LeSS framework and the Scrum@Scale Guide also do not mention cancellation, and it's harder to draw conclusions based on the relationships between teams, Sprints, and Increments in these frameworks.
The first question is: Does cancellation make sense?
Cancellation implies that the Sprint ends. In Scrum, when one Sprint ends, the next Sprint begins with Sprint Planning. I'm not sure this makes sense in a single-team environment, much less a scaled environment where multiple teams are synchronizing their events with each other and with external stakeholders.
As recent as the 2017 Scrum Guide, Sprint cancellations were described as "traumatic to the Scrum Team". In environments where you want highly motivated people, you want to avoid traumatic experiences. Although this terminology was dropped in the 2020 revision, I don't see how it doesn't apply today.
The Scrum Guide also doesn't say what happens when a Sprint is canceled. The Scrum events happen on a cadence. If the Sprint is canceled, there is no guidance for what the Scrum Team should do between the cancellation and the next Sprint Review, Sprint Retrospective, and Sprint Planning. If the cadence begins with an immediate Sprint Planning, the team will either adopt a new cadence (which may or may not work for stakeholders, who especially need to be involved in Sprint Review) or plan a short Sprint.
In my experience, having cadences is valuable. This is true in Scrum, scaled Scrum, and SAFe. Any action that would change the cadence should be avoided. This means that "canceling a Sprint" really means "pausing and refocusing the work". The team(s) affected either stop (and throw away) or wrap up any work-in-progress, depending on whether that work remains useful and valuable. They use the rest of the time in the Sprint to reorganize and refine the backlog and prepare for the next Sprint (and, in SAFe's case, the rest of the PI). The regularly scheduled Sprint Review (and, in SAFe's case, the System Demo and Iteration Review) would be a good time to synchronize with key stakeholders from outside the team to ensure their backlog reflects the current understanding of the state of the world and plan the next steps. and the Sprint Retrospective would be a good opportunity to understand what happened and if it is possible to detect and adapt earlier. Depending on the amount of effort needed to prepare the backlog, this could also be a good time for the team to pay down technical debt, do any kind of tool improvements, or pick up training and personal improvement.
Is this true to Scrum or SAFe? I'm not sure. However, I believe it more closely aligns with the reality of work. When something so disruptive happens that it invalidates the current plan, it's good to take some time and organize the pieces for the future to set up for longer-term success.